register activation hook
-
Hi,
I’m making my own plugin that will create a custom table upon activation for later use of my plugin.
I have a syntax error and I don’t see what I’m doing wrong here:
register_activation_hook(__FILE__, 'flashplayer_install');
this gives me this error:Parse error: syntax error, unexpected T_STRING in /Applications/MAMP/htdocs/wordpress/wp-content/plugins/flashplayer/fl_player_activation.php on line 34
this his my entire file:
<?php /* Plugin Name: Flash Vinyl Player Description: This is a flash player that gets his feed from an XML file Autor: Avril Verhaeghen Version: 1.0 */ /* Install the table when plugin is being activated */ function flashplayer_install(){ global $wpdb; $tbl_name = $wpdb->prefix.'flashplayer'; if( $wpdb->get_var("show tables like '$tbl_name'") != $tbl_name ){ $sql = "CREATE TABLE ".$tbl_name." ( id INT(10) NOT NULL AUTO_INCREMENT, title TINYTEXT NOT NULL, artist TINYTEXT NOT NULL, filename VARCHAR(100) NOT NULL, UNIQUE KEY id(id) );"; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); dbDelta($sql); } } register_activation_hook(__FILE__, 'flashplayer_install'); This is the function that can be called upon plugin activation ?>
Does anyone see where my syntax error is?
Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘register activation hook’ is closed to new replies.