Has anyone used wordpress?

Source: Internet
Author: User
Have you ever used wordpress? This is how wordpress can create a data table. if you can create a data table, is there any way to operate the created data table. I used the following code, which can be used in plug-ins on the Internet. But I didn't use it... have you ever used wordpress? This is how wordpress can create a data table. if you can create a data table, is there any way to operate the created data table. I used the following code, which can be used in plug-ins on the Internet. However, I have used it and it is useless. Is it because my code is wrong or the location is wrong?
Function wp_user_avatars_create_table (){

global $wpdb;$table_name = $wpdb->prefix . "test";if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name){         $sql = "CREATE TABLE IF NOT EXISTS " . $tablename . " (          `test_id` int(8) unsigned NOT NULL,          `test_name` varchar(200) CHARACTER SET utf8 NOT NULL,          `test_password` varchar(200) CHARACTER SET utf8 NOT NULL        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";          dbDelta($sql);}

}

Register_activation_hook (_ FILE __, 'WP _ user_avatars_create_table ');

Reply content:

Have you ever used wordpress? This is how wordpress can create a data table. if you can create a data table, is there any way to operate the created data table. I used the following code, which can be used in plug-ins on the Internet. However, I have used it and it is useless. Is it because my code is wrong or the location is wrong?
Function wp_user_avatars_create_table (){

global $wpdb;$table_name = $wpdb->prefix . "test";if($wpdb->get_var("SHOW TABLES LIKE '$table_name'") != $table_name){         $sql = "CREATE TABLE IF NOT EXISTS " . $tablename . " (          `test_id` int(8) unsigned NOT NULL,          `test_name` varchar(200) CHARACTER SET utf8 NOT NULL,          `test_password` varchar(200) CHARACTER SET utf8 NOT NULL        ) ENGINE=MyISAM DEFAULT CHARSET=utf8;";          dbDelta($sql);}

}

Register_activation_hook (_ FILE __, 'WP _ user_avatars_create_table ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.