MySQL Forums
Forum List  »  PHP

date_format problem
Posted by: dex 002
Date: May 08, 2005 08:19PM

The code below returns everything I want except the date column. I am not getting any syntax errors. Can anyone see where I've gone wrong?

...
$query = "select date_format('%d %m %Y', date) as date, story_id, heading, story from news order by date desc";
$result = mysql_query($query);
$num_results = mysql_num_rows($result);
for ($i=0; $i <$num_results; $i++)
{
$row = mysql_fetch_array($result);
$story_id = "<id>$row[story_id]</id>";
$date = "<date>$row[date]</date>";
$heading = "<heading>$row[heading]</heading>";
$story = "<story>$row[story]</story>";
$fullstory = "$story_id - $date - $heading - $story</br>";
echo $fullstory;
}
?>

Options: ReplyQuote


Subject
Written By
Posted
date_format problem
May 08, 2005 08:19PM
May 09, 2005 04:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.