Quantcast
Viewing latest article 5
Browse Latest Browse All 44

WordPress wpdb->insert returns int(0) => doesn't insert anything, no errors!

I am really clueless. I want to do an insertion in my WordPress plugin the problem is it doesn’t return any errors nor it insert the stuff!

I don’t know how to fix this and really need your help. In the following code i used example names, but i used the character - for these in case of that my real table has also names with - in it as well as the table itself.

Usually there is no problem, just use some back ticks “ and the stuff works well, but now welcome to WordPress. Is there a problem with the insertion function in WordPress or is there any other possible error?

I really tried to fix this by myself but i failed.

$insertion = $wpdb->insert($wpdb->prefix.'table-name-of-plugin', array(
                'column-name' => $stringValueForC1,
                'second-column-name' => $stringValueForC2
            ), array('%s, %s'));

If i use var_dump() for the insertion variable i get: int(0).
string 0 for wpdb->last_error and bool(false) for wpdb->last_query.

I also double checked my table name and it is 100% correct!
What can be the error?


Viewing latest article 5
Browse Latest Browse All 44

Trending Articles