我正在尝试将一些数据插入到表格中。由于某种原因,它只会让我插入数字而不是文本到特定的行,甚至不是一个单词。我已经尝试将行设置为不同的类型(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);
答案 0 :(得分:0)
您不是要插入太久的数据吗?
答案 1 :(得分:0)
试试这个:
$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错误说什么。