note 5778 deleted from die by danbeck
| From: | danbeck@php.net | Date: | Thu, 08 Mar 2001 18:00:30 +0000 |
| Subject: | note 5778 deleted from die by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12044@lists.php.net to get a copy of this message | ||
<pre>
HI Folks, with die you can also call a function.
eg. :
mysql_query("xxxx") or die mysql_error();
You can use your own function like :
function errmailer()
{
global x;
$err=mysql_error();
echo "There is an error";
mail("a@b.com","error message n $x","$err","from :
c@d.com");
}
and then you can give a command at a desired place like
mysql_query("xxxx") or die errmailer();
This can be useful quite a lot for debugging errors when they happen through unknown users and
through unkbown events trigerred by the user unknowingly
</pre>