[thelist] php/MySql Help Please

Jeremy Ashcraft ashcraft at 13monkeys.com
Tue Oct 2 22:55:32 CDT 2001


On Tuesday 02 October 2001 22:16, you wrote:

> This is of course not what we would want to happen when the site goes
> live.  Is this a method we wuold leave in a production page?  What would be
> a better way to handle development and production errors?

I use PHP/MySQL as my primary development platform.  More times than not, 
I'll just leave the die(mysql_error()) in there even on the production side 
just so users see an error when something does go wrong and can be 
descriptive about it if they report it.  If that's not your bag, you might 
want to use the error_log() function.  It can write out an error message to 
your webserver logs, send it to an email address, send it to the php 
debugger, or append it to a file you specify.  (I use the 2nd and last 
options).  I use it in a few places to record errors and to notify me 
immediately of major hiccups.

http://www.php.net/manual/en/function.error-log.php

example:  (this writes an error message to sql_error.log, mind the wrap)

........
mysql_query($sql_statement) or error_log("Error: bad query: 
$sql_statement",3,"/path/to/sql_error.log");
.........

HTH

jeremy




More information about the thelist mailing list