bulgin Posted February 19, 2009 Share Posted February 19, 2009 Using Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2 I have the following bit of code that sends out an email nicely. I need to wrap it in an if statement that will compare the web3_access_log.time_stamp which is an integer field with epoch time, to the current time and if greater than 1 hour send out the emails, otherwise do nothing. I'm not good at if statements and could use a little help if someone wants to offer. Thanks! <?php include 'config.php'; include 'opendb.php'; $mailer = mysql_query("SELECT web3_access_log.sent_or_not_sent, web3_access_log.logs_message_subject, web3_access_log.logs_body_message,web3_access_log.email_address, web3_access_log.time_stamp") or die (mysql_error()); while($user = mysql_fetch_assoc($mailer)){ $to=$user['email_address']; $subject=$user['logs_message_subject']; $body=$user['logs_body_message]; mail($to,$subject,$body) ; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/145966-solved-need-help-with-if-statement-comparing-times-and-taking-action/ Share on other sites More sharing options...
mjahkoh Posted February 21, 2009 Share Posted February 21, 2009 Try Tthis Assuming you have month,finyear,id in a table named calendar select month,finyear,id, CASE month when "01" then "January" when "02" then "February" when "11" then "November" when "12" then "December" END from calendar where year = "2005" order by month Quote Link to comment https://forums.phpfreaks.com/topic/145966-solved-need-help-with-if-statement-comparing-times-and-taking-action/#findComment-767632 Share on other sites More sharing options...
bulgin Posted February 21, 2009 Author Share Posted February 21, 2009 Thanks I finally figured out that I don't need an if statement I can do it all with a modified select statement. Thank you for your help! Quote Link to comment https://forums.phpfreaks.com/topic/145966-solved-need-help-with-if-statement-comparing-times-and-taking-action/#findComment-767841 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.