Current function to run mysql query in PHP and displays error on screen when there is one. I am trying to make it only show the qery and error message to a user with a session $_SESSION['auto_id'] == 1 and regualr users will just see a nice message saying there is an error
In the second example I attempted to do it but I am not sure how to parse the code correctly inside of or die(" ")
Works:
<?PHP
function executeQuery($sql) {
$result = mysql_query($sql) or die("<span style='FONT-SIZE:11px; FONT-COLOR: #000000; font-family=tahoma;'><center>An Internal Error has Occured. Please report following error to [email protected]<br><br>" . $sql . "<br><br>" . mysql_error() . "'</center></FONT>");
return $result;
}
?>
Doesn't Work:
<?PHP
function executeQuery($sql) {
$result = mysql_query($sql) or die("
<span style='FONT-SIZE:11px; FONT-COLOR: #000000; font-family=tahoma;'><center>An Internal Error has Occured. The error has been recorded<br>'</center></FONT>
if($_SESSION['auto_id'] == 1){
echo = '<br>' . $sql . '<br><br>' . mysql_error() . "
}
");
?>