In my LAMP application (using CodeIgniter), I have a call to $this->db->update… that generates a SQL like the following:
UPDATE `MyTable` SET `MyProcess` = 5 WHERE `Id` = 1
The problem is that this seems to work intermittently — and I currently have no idea what might be wrong. Is there anything about MySQL I need to know about when trying to update? I’m adding & updating records a lot (but probably no more than one query every 5 seconds). When I run the query in phpMyAdmin, it works fine.
This is an addition to Mark’s answer.
mysql_affected_rowsalso returns0if you try to update a record but the values in that record do not change.For example; current values in
MyTable:Then when you run your query:
mysql_affected_rowswill return0Could this be what is happening in your case?