MySQL вставка текста проблема - PullRequest
0 голосов
/ 25 февраля 2011

У меня кошмар, когда я пытаюсь вставить некоторые данные в таблицу. По какой-то причине он позволяет мне вставлять только цифры, а не текст в конкретную строку, даже в одно слово. Я пытался установить строку для разных типов (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);

Ответы [ 2 ]

0 голосов
/ 25 февраля 2011

Попробуйте это:

$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.

0 голосов
/ 25 февраля 2011

Вы не пытаетесь вставить слишком длинные данные?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...