"") { echo "

Sorry, there has been an unexpected database error. The webmaster has been informed of this error.

"; // Error number $error_message = ""; // Error Description $error_message .= ""; // Error Date / Time $error_message .= ""; // Client $error_message .= ""; // Script $error_message .= ""; // Line Number $error_message .= "
Error Number:" . @mysql_errno() . "
Error Description:" . @mysql_error() . "
Error Time:" . date("H:m:s, jS F, Y") . "
Client:" . $client . "
Script:" . $_SERVER["SCRIPT_NAME"] . "
Line:" . $line . "
"; // SQL $error_message .= ""; $error_message .= "
Query:" . $sql . "
Processes:"; $result = @mysql_list_processes(); while ($row = @mysql_fetch_assoc($result)) { $error_message .= $row["Id"] . " " . $row["Command"] . " " . $row["Time"] . "
"; } @mysql_free_result($result); $error_message .= "
"; $headers = "From: \"MySQL Debug\" <" . $email . ">\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; // comment the following line if you don't want to get email notifications of MySQL errors mail($email, "[MySQL Error] ". $client, $error_message, $headers); // comment the following line if you don't want to display the MySQL errors to the user echo $error_message; die(); } // if you add ?debug=1 to the end of the path this will always show the query and the number of rows it returns if ($_GET["debug"]=="1") { echo "
".$sql."
" . $total . " rows found.
"; } return $result; } ?>