Hey, as I was reading a different thread, I got to thinking... Can i compare time using "<" if I pass the date from my database through "strtotime"?
I have tried and failed... Arg... (maybe i am on the wrong track). I am looping some results from a MySql database, and one of my fields is a date (in MySql format yyyy/mm/dd). If that date is passed todays date I would like it to display text instead....
Here is what I have:
$today = strtotime(date("Y-m-d"));
mysql_select_db("$dbDatabase", $db) or die ("Couldn't select the database.");
$query="SELECT * FROM driver ORDER BY name";
$result=mysql_query($query);
$areanum=mysql_numrows($result);
$i=0;
while ($i < $areanum) {
$driverid=mysql_result($result,$i,"id");
$drivername=mysql_result($result,$i,"name");
$driverlicence=mysql_result($result,$i,"licence_expire")
Echo ' <tr bgcolor="#'.$tblbgcolr[$tst = !$tst].'">';
Echo '<td>';
Echo $drivername;
Echo '</td>';
Echo '<td>';
If (strtotime($driverslicence) > $today) {
Echo '<span id="Expire">Expired!</span>';
} else {
Echo $driverlicence;
}
Echo '</td></tr>';