I'm experiencing an odd situation while running an UPDATE with
users table, with columns
user_id (Primary Key) and
status, and the user 3 existing and with status 0, I run the following query:
update users set status = 8 where user_id = 3
On my machine, running the query with
$wpdb->query, I get the result of 1: 1 row affected.
On another machine I run the query with the PHP code and always get 0 rows: before running the query I checked the status and it was 0, and if I run it with another tool (e.g. command line mysql client), it says me that is 1 affected row.
The query method of wpdb returns the number of affected rows in case of update (https://codex.wordpress.org/Class_Reference/wpdb#Running_General_Queries).
My machine and the remote one have got the same PHP version (5.4.40), same mysql server version, and same wordpress version (4.2.2). About the mysql PHP extensions, in local I've installed mysql, mysqli and mysqlnd: on the other machine I've got mysql and mysqli.
Is there someone with some clues about the possible reason? Thank you.
I tried to run the query also with the
update method, but the result is always 0 rows affected. I start thinking that I found an incoherency in the $wpdb abstraction layer.