[RESOLVED] Trap error and continue
If $Field doesn't correspond to an actual field in my mySQL database I get an error. How can I trap if an error occurs (eg. ErrorFlag = True;) and then continue with the rest of the my code?
PHP Code:
$SQL = "SELECT * FROM MyTable ORDER BY $Field";
//Instead of die I want to trap error then continue
$query = mysql_query($SQL) or die("Error getting details<br>" .mysql_error());
Re: Trap error and continue
PHP Code:
$query = @mysql_query($SQL);
if (mysql_errno()) {
// do something...
}
Re: Trap error and continue
Thanks penagate, will give it a go tomorrow at work.