Questions tagged «dbdelta»

5
dbDelta不创建表
我经历了很多线程和Codex页面,并尝试弄乱了很多东西,但是我的代码似乎并没有创建表。而且我无法弄清楚我要去哪里。我检查了数据库中的booking_db_version,当我在文件中更新它时它会更新。 这是代码 global $booking_db_version; $booking_db_version = "1.0.0"; function booking_install() { global $wpdb; global $booking_db_version; global $tableprefix; $installed_version = get_option('booking_db_option'); $tableprefix = $wpdb->prefix . 'booking_'; require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); if ( $installed_version !== $booking_db_version ) { /* Create table for packages */ $packagetable = $tableprefix . 'packages'; $sql = "create table $packagetable …

1
dbDelta对FOREIGN KEY的支持
在PHP 5.3.13 / MySQL 5.5.21上,以下代码不起作用: if($check_custom_fields_form!=1){ $sql = "CREATE TABLE IF NOT EXISTS ". $table_custom_fields_form ." ( `form_name` longtext NOT NULL, `field_id` bigint(20) NOT NULL, FOREIGN KEY (`field_id`) REFERENCES $table_custom_fields (`ID`) ON DELETE CASCADE ON UPDATE CASCADE ) CHARACTER SET utf8 COLLATE utf8_general_ci"; dbDelta($sql); } if($check_subscribe_cat!=1){ $sql = "CREATE TABLE …
9 php  mysql  dbdelta 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.