How to check for empty and not a failure

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.

Read More

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?

Related posts

Leave a Reply

1 comment