Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter carpeaqua

    (@carpeaqua)

    I found the issue in my code. CREATE TABLE did not have a space before the table name, so the SQL query was failing. WordPress wasn’t informing me of that. For the Google Gods, here’s my finished code:

    // Activate Plugin

    register_activation_hook(__FILE__,’init_database’);

    function init_database() {

    global $wpdb, $table_prefix;

    global $favoritethis_db_version;

    $table_name = $table_prefix.”favorites”;

    if ($wpdb->get_var("show tables like '$table_name'") != $table_name) {

    require_once(ABSPATH . ‘wp-admin/upgrade-functions.php’);

    $sql = "CREATE TABLE " . $table_name . " (id mediumint(9) NOT NULL AUTO_INCREMENT, post_id<code>mediumint(9) NOT NULL default '0', PRIMARY KEY (</code>id

    ));”;

    maybe_create_table($table_name, $sql);
    add_option("favoritethis_db_version", "1.0");
    }
    }

    lesson learned: a good night’s sleep always fixes annoying bugs!

    Thread Starter carpeaqua

    (@carpeaqua)

    Looks like its the Markdown plugin causing it. Dunno why it stopped working all of a sudden, but it did cause havoc on an old MT install I had before.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)