If you insist on doing something this way, it's best to create your own query method that handles all of this. Sort of
function custom_mysql_query($query) {
$doDebug=true;
$result=mysql_query($query);
if(!$result) {
if($doDebug) {
echo "Query failed\n<br><b>$query</b>\n";
echo mysql_error();
}
else {
}
exit();
}
}
custom_mysql_query mysql_query, , , $debug - , , , .
: mysql_query , (, , ). . ( sql)
pdo mysql_ (Google , ).