Forum Moderators: coopster
<?php
$Date = Strtotime(date("j/n/Y - g:i a"));
$resulta = mysql_query("SELECT * FROM LoggedIn")
or die("SELECT Error: ".mysql_error());
while ($get_info = mysql_fetch_row($resulta)){
$i=0;
foreach($get_info as $field)
{
if($i==0){
$MID=$field;
}
if($i==2)
{
$ExpDate=Strtotime($field);
if($ExpDate<$Date)
{
mysql_query("DELETE FROM LoggedIn WHERE MID='$MID'");
}
}
$i++;
}
}
?>
>> the string dates are not comparing the way I am expecting them to
what exactly is happening? Have you looked at the timestamps to see what you are getting?
I would change this
$Date = Strtotime(date("j/n/Y - g:i a"));
to
$Date = time();
no point in Strtotime(date( if you are just looking for NOW. Though if the expiry time isn't NOW and you want to give it some datetime from the past then use mktime to create it.
is the value of $field getting properly assigned? I would do this first
echo '<p>ExpDate',$ExpDate;
echo '<br>Date',$Date;
if($ExpDate<$Date) echo '<p>Date is higher';
else echo '<p>ExpDate is higher';
then you can eyeball everything and check the values