I'm using a MySQL database, accessing it through PHP, and I want it to not show older entries then today's date. I had a heck of a time getting it to order them. I had it working before, now it's not. I have them ordered by ASC, by date, fine, but it's still showing older entries. I know my PHP is outdated, but any method will work for me. Here's my code.
Sorry if I come off as a complete ditz.. I come here if I don't know, and I'm relatively new to this, and always get hung up on dates.
So far it's been suggested to: Change the name of the "date" column. "date" is stored as datetime, not a string, so to change that to int
// this is where its set to show today and future dated entries
$sql = "SELECT * FROM $db WHERE date >= '$today' ORDER BY date ASC" or die(mysql_error());
$getit = mysql_query ( $sql, $conn );
print "<br><b><font size=4>Appointments Coming Up</b></font>";
while($row = mysql_fetch_array($getit, MYSQL_ASSOC))
{
print "<br>";
$row[date] = date("D-M-d-Y", strtotime($row[date]));
print "<br><font size=3><b>{$row['doctor']} at {$row['time']} {$row['ampm']} on $row[date]</font>";
}
Solved All I did was change the date column in the database to "dateappt" and it worked. Thanks for the help everyone.