Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mysql wordpress';dbs delta函数停止工作_Mysql_Wordpress - Fatal编程技术网

Mysql wordpress';dbs delta函数停止工作

Mysql wordpress';dbs delta函数停止工作,mysql,wordpress,Mysql,Wordpress,我正在开发一个需要数据库交互性的wordpress插件。我正在使用activate钩子中的dbDelta函数向数据库添加几个表。dbDelta函数上周起作用了,但是当我今天去添加另一个表时,什么也没发生。我也无法添加列或更改现有表的属性。有人建议在运行dbDelta之前中断sql命令,但这也不起作用 在您提问之前:是的,我已经阅读了codex页面并遵循了格式说明 代码如下: <?php function install () { global $wpdb; //use the g

我正在开发一个需要数据库交互性的wordpress插件。我正在使用activate钩子中的dbDelta函数向数据库添加几个表。
dbDelta
函数上周起作用了,但是当我今天去添加另一个表时,什么也没发生。我也无法添加列或更改现有表的属性。有人建议在运行dbDelta之前中断sql命令,但这也不起作用

在您提问之前:是的,我已经阅读了codex页面并遵循了格式说明

代码如下:

<?php
function install ()
{

    global $wpdb; //use the global variable wpdb, a class used to interact with wordpress's database

    //define table names, using the the db's prefix
    $gist_table = $wpdb->prefix . "cookbook_gist";
    $tag_table = $wpdb->prefix . "cookbook_tags";
    $tagKey_table = $wpdb->prefix . "cookbook_tagKeys";
    $comment_table = $wpdb->prefix . "cookbook_comments";
    $blacklist_table = $wpdb->prefix . "cookbook_blacklist";

   //Include the wpdb function

    require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); //the dbDelta function is in this file

    //create the sql statements to add the tables

    $sql = "CREATE TABLE $gist_table (
    gist_id mediumint NOT NULL,
    last_cached datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    last_updated datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
    author tinytext NOT NULL,
    description mediumtext NOT NULL,
    header mediumtext NOT NULL,
    body text NOT NULL,
    footer mediumtext NOT NULL,
    PRIMARY KEY  (gist_id)
    );";

    //Actually add the table
    dbDelta($sql);

    $sql = "CREATE TABLE $tag_table (
    tag_id mediumint NOT NULL AUTO_INCREMENT,
    tag tinytext NOT NULL,
    PRIMARY KEY  (tag_id)
    );";

    dbDelta($sql);

    $sql ="CREATE TABLE $tagKey_table (
    id mediumint NOT NULL AUTO_INCREMENT,
    gist_id mediumint NOT NULL,
    tag_id mediumint NOT NULL,
    PRIMARY KEY  (id)
    );";

    dbDelta($sql);

    $sql = "CREATE TABLE $comment_table (
    id mediumint NOT NULL,
    gist_id mediumint NOT NULL,
    author tinytext NOT NULL,
    date_created datetime NOT NULL,
    comment mediumtext NOT NULL,
    newcol text NOT NULL,
    PRIMARY KEY  (id)
    );";

    dbDelta($sql);


    $sql = "CREATE TABLE $blacklist_table (
    gist_id mediumint NOT NULL,
    PRIMARY KEY  (gist_id)
    );";


    dbDelta($sql); //makes the changes to the wp database    
}

?>

很抱歉给您带来困惑。几天前,我的托管服务更改了我们托管的服务器;我仍然登录到旧服务器来管理数据库。当我登录到正确的服务器上时,更改按预期进行