Get error messages when $wpdb->insert() returns false?

Question

$wpdb->insert() returns false which I’ve learned means that the insert failed. Now, I would like to know why it fails with the insert.

According to this ticket https://core.trac.wordpress.org/ticket/32315 the problem could be that the value is either too long or contains bad characters.

Here is the insert query:

$result = $wpdb->insert('table', $ins_args, array('%d', '%d', '%s', '%s', '%s', '%s'));

It’s difficult to show the $ins_args array values since some values are pretty long. Specially the one for field named value. But I use type longtext for that field. And this insert is used a lot. And most times it works with success. So it really feels like a encoding or size problem.

How do I get to know what the problem is? $wpdb->last_error is empty

0
, , Peter Westerlund 3 months 0 Answers 59 views 0

Leave an answer