php - Plugin could not be activated because it triggered a fatal error: unexpected 'require_once' -


i'm trying create custom table in mysql using plugin. here's code same:

<?php /* plugin name: zenva user table plugin uri: http://www.getevangelized.com description: custom table storing user data version: 1.0 author: manas chaturvedi author uri: http:www.getevangelized.com license: gpl2 */  register_activation_hook(__file__, 'create_update_table');   function create_update_table() {     global $wpdb;     $tablename = $wpdb->prefix."twitteruser";      if($wpdb->get_var("show tables '$tablename'") != $tablename)     {         $sql = "create table `$tablename`(             `user_id` int(20) not null auto_increment,             `twitter_handle` varchar(100) not null,             `oauth_token` varchar(200) not null,             `oauth_token_secret` varchar(200) not null,             `created` datetime,             primary key (user_id)             );"           require_once(abspath . 'wp-admin/includes/upgrade.php');         dbdelta($sql);     } }  ?> 

however, while activating plugin wordpress dashboard, i'm encountering following error:

parse error: syntax error, unexpected 'require_once' (t_require_once) in /opt/lampp/htdocs/wordpress/wp-content/plugins/user_table/user_table.php on line 31 

what seems wrong here? did check verify have upgrade.php file installed inside wordpress installation.

what seems wrong here?

there's semicolon missing @ end of the $sql = "…" block.

$sql = "create table `$tablename`(     `user_id` int(20) not null auto_increment,     `twitter_handle` varchar(100) not null,     `oauth_token` varchar(200) not null,     `oauth_token_secret` varchar(200) not null,     `created` datetime,     primary key (user_id)     );";  // <---- here 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -