Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

e-mail when new row entered in mysql

Status
Not open for further replies.

curelon

IS-IT--Management
Aug 15, 2002
1
DK
I'm new to mysql and was hoping to be able to set up a trigger that would send me a mail whenever a new row was created in a table. As far as I can see mysql doesn't have triggers, so can I do this with some kind of script, ex. PHP? If you have worked on the same problem, I would greatly appreciate any help.
 
well, you can use php only if the rows are inserted via some php script, otherway you wouldn't need php to send notices
if you use php script, just add to your code after the query running code something like this

mail('your@mail.address', 'new row inserted into table', 'hello, on your mysql server was just one of the tables updated, sincerely your server ;-)');

btw i would not do that on a highly visited server - on one of my sites, i would receive at least 5 mails while posting an order :-(
 
Far better off counting the number of rows added, time or preferably datestamping them and emailing once a day to say how many have been added.

If they are datestamped you can then query to see all lines added on x date.

My main server normally has around 1000 lines a day added... /hide and pheer email from that ;-) ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top