Error when activating my own plugin
-
Hi there, I’m working on my own plugin right now. It creates some custom pages that can be accessed in the admin panel. Which works after activating. Also the script I wrote should have to create a custom database table. The table won’t be created and I’m getting a weird error.
The error is in dutch
De plugin heeft 2350 fouten gegenereerd Onverwachte uitvoer tijdens activatie. Als je “headers al verzonden” berichten opmerkt, problemen met syndication feeds of andere problemen ervaart, probeer dan deze plugin te deactiveren of te verwijderen.
But it’s not specially saying what’s wrong.I think there’s something wrong with the methods that create the db table:
register_activation_hook(__FILE__, 'sportivity_api_active'); function sportivity_api_activate(){ create_location_table(); } function create_location_table(){ global $table_prefix, $wpdb; $table = 'locations'; $wp_track_table = $table_prefix . $table; #Check to see if the table exists already, if not, then create it if($wpdb->get_var( "SHOW TABLES LIKE '$wp_track_table'" ) != $wp_track_table) { require_once( ABSPATH . '/wp-admin/includes/upgrade.php' ); $sql = "CREATE TABLE IF NOT EXISTS <code>". $wp_track_table . "</code> ( "; $sql .= " <code>id</code> int(11) NOT NULL auto_increment, "; $sql .= " <code>title</code> varchar(128) NOT NULL, "; $sql .= " <code>description</code> varchar(200) NOT NULL, "; $sql .= " <code>sportivityApiKey</code> varchar(175) NOT NULL, "; $sql .= " <code>insertDate</code> bigint(8) NOT NULL, "; $sql .= " PRIMARY KEY <code>order_id</code> (<code>id</code>) "; $sql .= ") ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; "; dbDelta($sql); var_dump($wpdb->suppress_errors); wp_die(); } }
I hope someone can help me figure this out.
- The topic ‘Error when activating my own plugin’ is closed to new replies.