This weekend I a bad experience with a corrupt table, luckily I was automatically notified by a function I had added to the most import PHP scripts on my site. This saved me hours of diagnosis time and possible downtime (I would have been unaware of the error for days).
Its quite simple and can be added in just a few minutes:
function reportMySQLError($email, $MySQLError, $TheQuery)
{
mail($email,
"WARNING: Error running one of the MySQL queries on site!.",
"The SQL Error was: $TheSQLError The query was: $TheQuery",
"From: $email\nReply-To: $email");
}
...
THEN IN LATER in your code:
...
$result = mysql_query($the_query);
if (!$result) reportMySQLError($email, mysql_error(), $the_query);
Full details here:
http://dwalker.co.uk/forum/viewtopic.php?p=1413
I wish you all prosperity in health and wealth.
Dave