markspec87 Posted September 5, 2006 Share Posted September 5, 2006 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) Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted September 5, 2006 Share Posted September 5, 2006 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? Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted September 5, 2006 Share Posted September 5, 2006 if(mysql_insert($sql) == 1){ SendMail();} Quote Link to comment Share on other sites More sharing options...
Stevis2002 Posted September 5, 2006 Share Posted September 5, 2006 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.