I just want to send a mail when a table is populated with new row in database. My database is MySQL. Actually i have two relation job(job_id,title,user_id) and user(user_id, user_name,email) in MySQL I want to send an email when new records inserted in job table i don't know how can I'll do and my front end is in PHP.
Asked
Active
Viewed 1,772 times
0
-
1You have to write some kind of code to do that. – woz Dec 10 '13 at 21:21
-
I know that it will happen with some trigger. But I am quite new to programming, so if anyone come with some code for it, it will help me. – Akash Mishra Dec 10 '13 at 21:28
-
You haven't indicated what language or framework you're using. Show what you've done so far and it will be easier to help. – woz Dec 10 '13 at 21:33
-
take a look at this link. This might help you. http://stackoverflow.com/questions/387483/how-to-send-email-from-mysql-5-1 – noobdeveloper Dec 11 '13 at 01:28
1 Answers
-1
You could possibly use a trigger to do what you want, but MySQL can't make an external call from a trigger function - only internal things (like changing another row).
I think you must default to polling the database. You might find SELECT COUNT(*) FROM table; helpful, to count the records in a table to find out if anything has changed. Most DBs run such queries very fast, so it would be ok to poll the server using it if there was only one client polling. Once you have identified a change, then use other SQL to identify whether it is a significant change (i.e. one requiring an email) and remember you might have more than one email to send :-)

rivimey
- 921
- 1
- 7
- 24