Request code to compare times and send message

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bulgin
Forum Commoner
Posts: 29
Joined: Wed Feb 11, 2009 8:47 pm

Request code to compare times and send message

Post by bulgin »

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) ; 
}
 
?>
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: Request code to compare times and send message

Post by susrisha »

Post Reply