Why is Wordpress $wpdb->query() response 1 when the rows returned is 0
Posted
by codecowboy
on Stack Overflow
See other posts from Stack Overflow
or by codecowboy
Published on 2010-06-07T13:20:46Z
Indexed on
2010/06/07
13:22 UTC
Read the original article
Hit count: 186
I'm doing the following in a custom function:
$exists = $wpdb->query($wpdb->prepare('
SELECT COUNT(*)
FROM wp_%d_gdsr_data_article
WHERE post_id = %d
', $blog_id, $post_id));
$exists evaluates to 1 even if no rows are returned by the query. Also, var_dump($wpdb->queries) yields a NULL. Anyone know what is going on here?
thanks,
© Stack Overflow or respective owner