Request code to compare times and send message
Posted: Thu Feb 19, 2009 10:45 am
I have the following code which works nicely sending out an email. I need to wrap the whole thing in an if statement that will compare the web3_access_logs.time_stamp which is an integer and displays epoch time, with the current time and if the difference is greater than 1 hour, send out the email, otherwise do nothing. Can someone suggest what to do? I'm not very good at if statements. Thanks.
Code: Select all
<?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, [b]web3_access_log.time_stamp[/b]") 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) ;
}
?>