I'm writing a feed reader plugin for wordpress. I'm seeing a DB error that I can't figure out. First I create a table called user_entries. Then I put a sample entry into that table. When I try to delete an entry, I get a very strange error in my debug log. There are no foreign keys yet, no indices on the db, etc.
[02-May-2012 11:21:52] WordPress database error for query DELETE FROM wp_wprss_user_entries
WHERE owner_uid = 2 AND feed_id = 2; made by do_action, call_user_func_array, wprss_unsubscribe_feed, WprssFeeds->remove
So what is the error? It's just blank in there. This doesn't look like complicated SQL and it works fine in the phpmysql query window. I'm not sure what to do for a next step now, and I'd like folks to be able to unsubscribe from a feed!
Figured it out! $wpdb->print_error()
prints that error string even if there isn't an error. SO you have to check explicitly to see if the query returned false - not 0.
if(false === $wpdb->query($sql)){
$resp->uf_error = $wpdb->print_error();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With