You solution can create a huge spam:
what happens if you have in a page with 100 mysql_query(), and all queries fail, and to spice it up, the page is getting accessed 100 times/minute.
How many emails you receive? What happens to your mail server and your mailbox?
A better solution is using a database abstraction layer for mysql, with error reporting implemented as class method:
class dbMySQL
{
//.....
function raiseError()
{
//
//here create message, maybe display it to user saying that the admin has beed notified and he should try again later
//log it in a table/file (if possible)
//check for spam (mails sent to admin should be logged)
//notify the admin by email or other ways: sms, net send, etc...
}
//...
}
as class, or Exception
(
http://www.php.net/~helly/php/ext/spl/classException.html)
derivated class (Creole has something like that implemented):
http://koders.com/php/fidC3C897243FDB1B5666C4B5237CA52696124414FA.aspx?s=%22SQLException+extends+Exception%22
(binarycloud is a framework that uses Creole for database access)
I didn't post any php code, because the approach depends on each application type.