ecorvo ecorvo -3 years ago 159
PHP Question

$wpdb->insert not working, last_query doesn't show insert "SHOW FULL COLUMNS FROM"

I run

$wpdb->insert($table, $data)
where data is an array with column_name => value and the insert is not working. I tried
and something bizarre comes back:

SHOW FULL COLUMNS FROM `table_im_trying_to_insert`

Why is the last query not my insert?

Answer Source

I found the problem. Apparently with the new WP update if you try to insert into a VARCHAR column and the column length is less than what you are trying to insert it just won't work. Prior to this update it will insert it but trim off the excess characters.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download