> * if the update does not have anything to work on
>   it does not mean it is a failure! except when you
>   EXPECTED it to update something.

Right, and the function doesn't care what you expect
anyway. :-)

> * i'm not sure whether  "if ($query)" is the proper
> way to check this. for trapping development errors i
> always suggest:
> $q="update members set company="\$company\", .......
> $query=mysql_query($q) or
>      die ('<hr>DB update failed in '.__FILE__.' line
>      '.__LINE__.'<br>Query was:'.$q.'<br>mysql
>      reported:'.mysql_error());

His way of trapping an error was fine, actually, though it
is a bit more elegant to say:

if (!mysql_query($sql))
{
   echo "Error";
}

To die() on error is great for debugging, but it isn't very
elegant in production (without some good custom error
handling, in which case it is fine). Testing whether the
function returned true or false allows you to take any
action you desire.

His logic was the only real problem. For some reason, quite
a few people seem to not understand what an error is.

Chris

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to