Update them all. It is easier (and faster) to do that even if none of them
has changed than it is to try and figure out which one changed. MySQL
doesn't do anything if the row/column hasn't changed, so there is only the
overhead of a connection, which is already there since you are doing the
fetc
Yes, I know that one query is more efficient than 3, but I'm trying to
do a mysql_fetch_array that automatically changes the row at the end of
the script if it has changed. I'm trying to decide whether to make it
only update the changed rows or be lazy and make it update them all if
only 1 has
Straight from the MySQL Documentation, which is where you should look first
always:
http://www.mysql.com/documentation/mysql/bychapter/manual_MySQL_Optimisation.html#Update_speed
5.2.10 Speed of UPDATE Queries
Update queries are optimised as a SELECT query with the additional
overhea