hmm, what I would suggest is that, from the function where you make any change to the database, call another function like: send_notice(). This function will send the e-mail.
Example:
function main() {
// this is the main routine
print "hello.... making changes to mysql table";
make_changes_to_table();
}
function make_changes_to_table() {
mysql_connect....
mysql_query....
send_notice();
}
function send_notice() {
mail("me@myaddress.com", "subject: notice", "a change has been mage");
}
If you want an autonomous program which detects changes, then one simple thing you can do is send a notice when a new entry is added or deleted. So you can do:
SELECT count(*) FROM table
and compare this count every .... lets say 5 minnutes.... and if it changes, send an e-mail.
If you can give me more details (like how and why you plan to send a notice), I can give you more suggestions.
-sridhar