I'd appreciate any help with this problem as although I've been trawling tutorials online etc I still can't get my head around the date formatting concept when displaying data from MySQL in PHP.
Code is as follows:
$events = @mysql_query('SELECT StartDate, EndDate, EventTitle FROM events WHERE StartDate >= NOW()');
while ($event = mysql_fetch_array($events))
{
$startdate = $event['StartDate'];
echo $startdate;
}
Now when I read some tutorials it suggested putting in DATE_FORMAT before the StartDate field in the MySQL select query, but this is not working for me when using the following code:
$events = @mysql_query('SELECT DATE_FORMAT(StartDate, '%d'), EndDate, EventTitle FROM events WHERE StartDate >= NOW()');
It is not displaying any results now. I changed the types of quotation marks around the SQL query incase that made a different but to no joy.
Any assistance would be appreciated! Basically I just want it to display 20th instead of 2008-06-20 etc.
Thanks
Code is as follows:
$events = @mysql_query('SELECT StartDate, EndDate, EventTitle FROM events WHERE StartDate >= NOW()');
while ($event = mysql_fetch_array($events))
{
$startdate = $event['StartDate'];
echo $startdate;
}
Now when I read some tutorials it suggested putting in DATE_FORMAT before the StartDate field in the MySQL select query, but this is not working for me when using the following code:
$events = @mysql_query('SELECT DATE_FORMAT(StartDate, '%d'), EndDate, EventTitle FROM events WHERE StartDate >= NOW()');
It is not displaying any results now. I changed the types of quotation marks around the SQL query incase that made a different but to no joy.
Any assistance would be appreciated! Basically I just want it to display 20th instead of 2008-06-20 etc.
Thanks