Jump to content

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


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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.