Jump to content

Archived

This topic is now archived and is closed to further replies.

markspec87

Email upon new database entry?

Recommended Posts

I have a page where users can submit thier own news / articles.

When they complete this form is there any code  ican use to email me that someone has added something (at the same time as it adds it to the database)

Share this post


Link to post
Share on other sites
Yes, i should think that you could do an 'if' statement which checks to see if the id, (which hopefully is auto incremented when a new record is inserted), has gone up one, and then in the statement put the mail function.

Something like that?

Share this post


Link to post
Share on other sites
An easier way might be to add the code into a function.
EG, the function which sends all the info to the db, should post an error if there is a problem, which makes your if - else statements.

So under the actual process for posting the info into the db, you could add the process for mailing a email to yourself, and if anythink fails, then it will give the user the standard db error

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.