Code: Select all
<?php
$sql = "UPDATE ...";
if ( !$db->sql_query($sql) || !$db->sql_affectedrows())
{
//run error reporting
}
else
{
//run second update query
}
?>If there are no changes to the data used in the first UPDATE query, the script returns an affected row count of 0. When that happens, it runs the error script and does not update the second portion of data. My question is: how do you check your result to see if the first update had zero affected rows because the data did not change AND NOT because of an SQL error?
Any insight on this issue would be most appreciated. Up until today I had no idea that MySQL did not return an affected row count if the data in the UPDATE query did not change.