We know from the manual that the Mysql_affected_rows function returns an exception value when the data is the same before and after the update.
Here is a convenient solution, from the official munual to see bdobrica at gmail dot com message:
As a solution to the "problem pointed in the" Post reffering to Mysql_affected_rows () returning 0 then are making an upd Ate query and the fields are not modified although the query is valid, I ' m posting the following function. It is very the simple and based on a previous post.
Copy Code code as follows:
function Mysql_modified_rows () {
$info _str = Mysql_info ();
$a _rows = Mysql_affected_rows ();
Ereg ("Rows matched: ([0-9]*)", $info _str, $r _matched);
return ($a _rows < 1)? ($r _matched[1]? $r _matched[1]:0): $a _rows;
}
PS: Because this little problem for a long time, I feel that PHP is too unclear