Forum Moderators: coopster
For some reason a particular call to mail() that I make is crashing my PHP error script; it works fine in other scripts, but not here. I'm certain it is mail() that is the problem, as if I remove the call then everything works.
Basically the situation is that the script does a lookup in the database for an error message, but if it can't find one then I want it to get the generic message and email the web admin. A cut-down script snippet follows: -
$error = mysql_query("SELECT err_msg
FROM _website_err
WHERE err_id = '$error_code'");/* If no error message was returned, return the generic msg and email the webadmin. */
if (mysql_num_rows($error) == 0) {
$error = mysql_query("SELECT err_msg
FROM _website_err
WHERE err_id = -1");mail("$email", "email error", "blah...");
}
If I remove the call to mail() everything works perfectly, but even using as simple a call as that above gives me a 500 Internal Server error.
Any suggestions would be much appreciated!