Jump to content

[SOLVED] Need help with if statement comparing times and taking action


bulgin

Recommended Posts

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) ; 
}

?>

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.