Thanks so much! set_error_handler solved the problem of having the PHP errors displayed.
The problem I am having now is that it is calling the error function 17 times, but only providing error messages to the function on the first instance. So this means I am getting 17 emails alerting me to one error but only the first email actually has any of the variables included. This is ok I guess because I could just make an if statement and only recognize it if $errno!="" but that seems silly.
Ill show you what I have right now. Here is the file that is supposed to handle the error messages.
PHP Code:
<?php
$old_error_handler = set_error_handler("ErrorHandler");
function ErrorHandler($errno, $errstr, $errfile, $errline)
{
date_default_timezone_set('-O500');
$date=date('l jS \of F Y h:i:s A');;
$page=$_SERVER['PHP_SELF'];
$errno=mysql_errno();
mail("name@email.com","SQL ERROR:".$errno,"Error Number:".$errno."\n\n Error Message:".mysql_error()."\n\n Date (no daylight):".$date."\n\n Page:".$page);
echo "submit<br />";
}
?>
Here is the test file that generates an error:
PHP Code:
<?php
include "error_submit.php";
mysql_query("INSERT INTO ecoprofs(invalid) VALUES ('$nothing')") or die();
?>
Any help would be great
Oh and I realize I am being redundant with my variables in the error email page, I just didnt change them after I made the changes you suggested.
__________________
DVD Movie Release Database: Please login or register to view this content. Registration is FREE
Last edited by Truly; 07-14-2009 at 07:26 AM..
|