I am developing a WordPress plugin that requires database interoperability. I am using DBDLTA function in my active hook to add multiple tables to the database. Before you ask: Yes, I have read the codex page and have followed the formatting instructions. Here's the code: My hosting service hosted on the server a few days ago went; And I was still logging on the old server to manage the database. When I logged on to the correct server, the changes were expected. dbDelta functioning last week was , but when I was adding another table today nothing happened I used to add columns or change the properties of existing tables was not able. Someone suggested to break SQL commands before running dbDelta, but it does not work either.
& lt ;? Php function installs () {global $ wpdb; // Global variables use WPDB, a class / db prefix that is used to interact with the database of WordPress $ gist_table = $ wpdb- & gt; Defines table names using prefix. "Cookbook_gist"; $ Tag_table = $ wpdb- & gt; Prefix "cookbook_tags"; $ TagKey_table = $ wpdb-> Prefix "cookbook_tagKeys"; $ Comment_table = $ wpdb-> Prefix "cookbook_comments"; $ Blacklist_table = $ wpdb- & gt; Prefix "cookbook_blacklist"; // include wpdb function require_once (ABSPATH. 'Wp-admin / include / upgrade.php'); // DBDLTA function is in this file // Create SQL statement to add table $ sql = "subscribe table $ gist_table (gist_id mediumint, zero, last stored datetime, '0000-00-00 00:00:00' No, Last_Arrited Date Time Lapse '0000-00-00 00:00:00' No, author, not a small reader, the description is not medium text, the title is not secondary text, body text, pastor media text, zero, primary key (gist_id )), "; // Really add table dbidilta ($ sql); $ Sql = "Creating a table $ tag_table (Tag_id MediaType not tap AUTIGMENT, tag TinyTextNull, Primary key (tag_ID));"; DbDelta ($ SQL); $ Sql = "Host $ Tablet Tag (ID Secondary Not AUTOCCCment, GISID Media Device Null, Tag_ID MediaMet Faucet, Primary Key (ID));"; DbDelta ($ SQL); $ Sql = "Create table $ comment_table (id is secondary, not zero, gist_id is not secondary, author, not small reader, not dated as of date, zero, at least medium text, zero, new key text not primary Key); "; DbDelta ($ SQL); $ Sql = "Make Tablet $ blacklist_table" (gist_id is not secondary, primary key (gist_id)); "; DbDelta ($ SQL); // changes WP database?}? & Gt; Sorry for the confusion
Comments
Post a Comment