Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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插入文本问题_Mysql_Wordpress_Insert - Fatal编程技术网

mysql插入文本问题

mysql插入文本问题,mysql,wordpress,insert,Mysql,Wordpress,Insert,我正在做一个噩梦,试图在表中插入一些数据。出于某种原因,它只允许我在特定的行中插入数字,而不允许在其中插入文本,甚至一个单词也不允许。我尝试过将行设置为不同的类型(Text、Varchar、Longtext),但没有乐趣,这有什么原因吗?我以前已经做过很多次了,我完全无法理解为什么它现在不起作用 问题行是order_note和test,查询如下: $table_name = $wpdb->prefix . "dpsc_transactions"; $query = "INSERT INTO

我正在做一个噩梦,试图在表中插入一些数据。出于某种原因,它只允许我在特定的行中插入数字,而不允许在其中插入文本,甚至一个单词也不允许。我尝试过将行设置为不同的类型(Text、Varchar、Longtext),但没有乐趣,这有什么原因吗?我以前已经做过很多次了,我完全无法理解为什么它现在不起作用

问题行是order_note和test,查询如下:

$table_name = $wpdb->prefix . "dpsc_transactions";
$query = "INSERT INTO {$table_name} (`invoice`, `date`, `order_time`, `billing_first_name`, `billing_last_name`, `billing_country`,
`billing_address`, `billing_city`, `billing_state`, `billing_zipcode`, `billing_email`, `phone`, `shipping_first_name`, `shipping_last_name`,
`shipping_country`, `shipping_address`, `shipping_city`, `shipping_state`, `shipping_zipcode`, `products`, `payment_option`, `discount`,
`tax`, `shipping`, `total`, `order_note`, `test`, `payment_status`) VALUES ('{$invoice}', NOW(), {$order_time}, '{$bfname}', '{$blname}', '{$bcountry}', '{$baddress}',
'{$bcity}', '{$bstate}', '{$bzip}', '{$bemail}', '{$phone}', '{$sfname}', '{$slname}', '{$scountry}', '{$saddress}', '{$scity}', '{$sstate}', '{$szip}',
'{$products}', '{$payment_option}', {$dpsc_discount_value}, {$tax}, {$dpsc_shipping_value}, {$dpsc_total}, {$order_note}, {$test}, 'Pending')";
$wpdb->query($query);

您没有尝试插入太长的数据,是吗?

尝试以下操作:

$query = "INSERT INTO {$wpdb->prefix}dpsc_transactions (`invoice`, `date`, `order_time`, `billing_first_name`, `billing_last_name`, `billing_country`,
`billing_address`, `billing_city`, `billing_state`, `billing_zipcode`, `billing_email`, `phone`, `shipping_first_name`, `shipping_last_name`,
`shipping_country`, `shipping_address`, `shipping_city`, `shipping_state`, `shipping_zipcode`, `products`, `payment_option`, `discount`,
`tax`, `shipping`, `total`, `order_note`, `test`, `payment_status`) VALUES ('{$invoice}', NOW(), '{$order_time}', '{$bfname}', '{$blname}', '{$bcountry}', '{$baddress}',
'{$bcity}', '{$bstate}', '{$bzip}', '{$bemail}', '{$phone}', '{$sfname}', '{$slname}', '{$scountry}', '{$saddress}', '{$scity}', '{$sstate}', '{$szip}',
'{$products}', '{$payment_option}', '{$dpsc_discount_value}', '{$tax}', '{$dpsc_shipping_value}', '{$dpsc_total}', '{$order_note}', '{$test}', 'Pending')";
$wpdb->query($query);

或者告诉我mysql错误是怎么说的。

你看到的mysql错误是什么?是
行的id=woodoo
?粘贴错误。OP说,“连一个词都没有”来解释您更改的内容通常是个好主意:)当然我找到了,但它花了一分钟。更改是在值()部分的
测试和
顺序注释
变量周围加引号。是的,就是这样,我需要在变量周围加引号,如果你插入数字,你不需要引号,如果你插入文本,你需要引号。当我从一个数字变量复制代码时,我错过了引号!!最简单的事情会浪费大量的时间。非常感谢你的帮助。