I am trying to run a PHP if statement that says if there are more than 3600 seconds between two MySQL timestamps than do something. I think I have the IF statement written correctly but something is going on where it is always being resolved to true.
$time1=mysqli_query($con,"SELECT time_to_sec(max(time)) as time FROM table");
$time2=mysqli_query($con,"SELECT time_to_sec(max(time)) as time FROM table and time <>(SELECT max(time) FROM table)");
if (($time1->fetch_object()->time) - ($time2->fetch_object()->time) > 3600);
{
echo $test
}
When I run:
echo $time1->fetch_object()->time-$time2->fetch_object()->time;
It shows the correct value that I would expect but even if its less than 3600 it still does the echo $test. Any ideas what can be causing this?
Thank you!!!