...

View Full Version : run query 1 hour after insert



seco
01-23-2010, 12:16 PM
would a cron be the best way to run a query about a hour after its inserted?

for instance, someone signs up, they get a email to enter feed back a hour later.

any ideas besides cron or is that the best way?

abduraooft
01-23-2010, 12:26 PM
would a cron be the best way to run a query about a hour after its inserted?

for instance, someone signs up, they get a email to enter feed back a hour later. I think so. Make a cron to fetch all such users from DB for sending the emails.

JAY6390
01-23-2010, 01:27 PM
I think this is the only way you'll be able to do it really

byuhobbes85
01-23-2010, 05:14 PM
Yeah, I would have a single script that ran every minute (or 5 minutes or 15 minutes, depending on how close to an hour you want it to be). I would make sure there are two fields in the database--time of sign up and a flag indicating whether they have received an email. The script that runs every minute (or 5 or 15) would then check to see if there were any sign ups that occurred at least an hour ago that had not yet received an email, and then send an email to those people and update the database.

Hope this helps.

JAY6390
01-23-2010, 05:17 PM
I'd advise every 15 mins personally. You'll just be running more queries than required otherwise IMO

ninnypants
01-23-2010, 07:12 PM
You could also run it as a pseudo cron and just include the cron script at the end of your page.

seco
01-23-2010, 07:53 PM
thanks for the heads up guys, guess its cron



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum