I’m querying the postmeta table to see if a url has already been entered, using this statement (where $thisLink is the url I’m checking)
$mypostids = $wpdb->get_results("select * from $wpdb->postmeta where meta_key = 'rssmi_source_link' and meta_value like '%".$thisLink."%'");
The problem is that on some servers it appears it’s not finding urls that already exist in the database, and I’m becoming convinced that this may be due to the server failing on the query or something like that.
Anyway, I’m not sure how to check for both the url already exist (thus don’t process anymore) or there was some sort of failure in completing the query). right now, I just use:
if (empty( $mypostids )){ do stuff}
is there a way I could make the condition like if empty AND if not a failure then do stuff?
You test for a fail by explicitly testing for false:
NB: three equals signs! you want to check for identical, not just equivalent
edit: originally said
false
, changed tonull
after looking at get_result() function in source.