[wp-hackers] $wpdb->query update and the number of records effected.
Haluk Karamete
halukkaramete at gmail.com
Fri Feb 8 17:24:10 UTC 2013
I run this;
global $wpdb; //wpdb is the wordpress database class
var_dump ($wpdb->query( "UPDATE $wpdb->posts SET comment_count=0"));
And I get this by the var_dump
int(19979)
then I reload the php page again ( to execute same SQL ) and the
var_dump reports
int(0)
Should not this query always effect 19979 records?
I thought the number of recs effected is really whatever the where
scope happens to be covering.
Since there are 19979 recs in the posts table, I was expecting this
operation spans/touches/operates/whateveer very you want to call it
all the recs!
I guess whether the values in the comment_count field was 0 or not
seffect the return of the wpdb->query.
Is this a mySQL behaviour? or does wordpress do something here? Or is
there somesort of a caching involved?
More information about the wp-hackers
mailing list