I tried something similar to this, like
$error=substr(mysql_error(),0,10)
if ($error == "Cannot upda")
{
echo blah
}
But this did not work either. It just doesn't seem to echo anything onto the screen. I don't think that it is catching anything, does the error code come with mysql_error ...