itwebguy Posted March 29, 2010 Share Posted March 29, 2010 Hey Everyone, I need to be able to check a mysql database hourly to send if the time set in the table is the current time and then send out a reminder letter. How can I do this?? Code and examples would be great. Link to comment https://forums.phpfreaks.com/topic/196836-check-mysql-database-hourly-and-send-email-asap/ Share on other sites More sharing options...
jcbones Posted March 29, 2010 Share Posted March 29, 2010 Very limited info, gets very limited help. file.php $sql = "SELECT * FROM `table` WHERE `timestamp` = NOW()"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { while($r = mysql_fetch_assoc($result)) { //Select data, then use: } //then mail. mail($to,$subject,$message,$headers); } crontab quick-reference http://adminschoice.com/crontab-quick-reference 0 * * * * curl --silent --compressed http://mysite.com/file.php Link to comment https://forums.phpfreaks.com/topic/196836-check-mysql-database-hourly-and-send-email-asap/#findComment-1033323 Share on other sites More sharing options...
itwebguy Posted March 29, 2010 Author Share Posted March 29, 2010 I want code that is running on the server checking the database automatically not in response to a user request. Would I need a Web Service?? I am on sure that is why I am asking! Very limited info, gets very limited help. file.php $sql = "SELECT * FROM `table` WHERE `timestamp` = NOW()"; $result = mysql_query($sql); if(mysql_num_rows($result) > 0) { while($r = mysql_fetch_assoc($result)) { //Select data, then use: } //then mail. mail($to,$subject,$message,$headers); } crontab quick-reference http://adminschoice.com/crontab-quick-reference 0 * * * * curl --silent --compressed http://mysite.com/file.php Link to comment https://forums.phpfreaks.com/topic/196836-check-mysql-database-hourly-and-send-email-asap/#findComment-1033337 Share on other sites More sharing options...
trq Posted March 29, 2010 Share Posted March 29, 2010 I want code that is running on the server checking the database automatically not in response to a user request. Would I need a Web Service?? You would use Cron on a Linux server or Task Scheduler on windows. Link to comment https://forums.phpfreaks.com/topic/196836-check-mysql-database-hourly-and-send-email-asap/#findComment-1033352 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.