$query = sprintf("select * from sometable;");
$result = mysql_query($query) or die (mysql_error());
modified to:
$query = sprintf("select * from sometable;");
$result = mysql_query($query) or $DBError=true;
Now I want to execute 2 statements if the query fails, is this possible using the "short above"? e.g. something like this:
$query = sprintf("select * from sometable;");
$result = mysql_query($query) or {$DBError=true; $ErrorCode=0;}
trueor do you want to set the variables$DBErrorand$ErrorCodeafter the execution ofmysql_query? Notice that documentation says thatmysql_queryshould NOT end with;(php.net/manual/en/function.mysql-query.php)