The code below is supposed to initiate CSS based on if($row["datesubmitted"] > $livetime){. The CSS should go into effect if “datesubmitted” is less than 1 hour old. But it’s not working.
Any idea why not?
For comparison, the same code works with the IF statement if($row["topten"] == 1){.
EDIT: In MySQL, datesubmitted is Type = timestamp and Default = CURRENT_TIMESTAMP.
Thanks in advance,
John
$livetime = time()-3600;
$result = mysql_query($sqlStr);
$arr = array();
echo "<table class=\"samplesrec\">";
while ($row = mysql_fetch_array($result)) {
$dt = new DateTime($row["datesubmitted"], $tzFrom);
$dt->setTimezone($tzTo);
if($row["datesubmitted"] > $livetime){
Maybe you can try using strtotime, like this..
if(strtotime($row["datesubmitted"]) > $livetime)
it’ll work since your $row[“datesubmitted”] is a datetime format from mysql..