Hi Dan,

> How can i include error notification, like if an MySQL error occurs,
> to notify me of the offending page and what the error was, while
> having the page die quietly or nicely, like an message saying that
> the webmaster will be notified please continue?

you can make a generic function to be called when such error occured.
the fucntion will print a nice/default error msg to user and you can
log detail information regarding the error into logfile or DB,
or even send out a notification email to you.

function fatal_error($msg, $file, $line) {
  //$msg : the to be logged
  //$file: name of file which trigger the error
  //$line: line number which trigger the error

the usage:

include('<lib which contain fatal_error()>');
@mysql_query or fatal_error (mysql_error(), __FILE__, __LINE__);

__FILE__ and __LINE__ are php predefined constant to indicate current
file and line number which is being parsed/executed.

you always have to pass this __FILE__ and __LINE__ because PHP dont
have the ability to "backtrack" from which file/line a function is
called :(

and dont forget to add "@" sign in front of the PHP's function,
to surpress the error msg generated by PHP.

There is no greater waste as a waste of time

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to