Hi, I'm writing a webpage to list events in my hometown. I want to display only events from 'today' onwards, including 'today'. All my dates are in a datefield and I'm using CURDATE() to select only what I want, but it's missing a date that should be selected. To be exact, I wrote the code on 2006-08-07 (7th aug), and the first event listed on my page was 2006-08-09 (9th aug), when there was a gig on 2006-08-08 (8th aug). I've checked that the date is indeed in my database correctly, it is, and I've made the same query directly within phpMyAdmin, and it finds the date no problem. So is the fault in the code I'm using to display the data?
Here's my code:
$query = "SELECT DATE_FORMAT(eventDate, '%a %D %b') AS date,
eventTalent, eventVenue,
FROM event
WHERE eventDate >= CURDATE()";
$result = mysqli_query($connection,$query)
or die ("couldn't execute query");
$row = mysqli_fetch_array($result,MYSQL_ASSOC);
while ( $row = mysqli_fetch_array($result))
{
extract($row);
echo "<ul>
<li>$date:</li>
<li>$eventTalent</li>
<li>@ $eventVenue</li>
</ul>\n";
}
...and I've also checked that SELECT CURDATE() on my machine does return
the correct date: it does. Without CURDATE all the dates are listed ok.