A small digest of how it should be :
--- 8< ---
$db=mysql_connect ("localhost","login",pwd");
$cmd="UPDATE mytable SET name='$name'";
$result=mysql_query($cmd,$db);
if (!$result)
{ ErrorMsg();
}
$nb_rows1 = mysql_affected_rows($db);
$cmd="UPDATE mytable SET name='$name'";
$result=mysql_query($cmd,$db);
if (!$result)
{ ErrorMsg();
}
$nb_rows2 = mysql_affected_rows($db);
...
if ( ($nb_rows1 < 1) && ($nb_rows2 < 1) )
{
}
--- 8< ---
why would you replace mysql_affected_rows ?
(if $db is a global variable, you can
do the mysql_connect at the beginning of
your program and use it by saying
"global $db;" at the beginning of the function calling mysql_affected_rows() for
instance)