PattyB Posted September 18, 2006 Share Posted September 18, 2006 Hi, I have the following code using date_format but it does not return anything. Am I using this rightor is there a problem somewhere else? If I have just date it returns the value fine.[code]$newsquery = "SELECT id, author, title, article, date FROM news order by date DESC LIMIT 0, 3";$newsresult = mysql_query($newsquery);while($row=mysql_fetch_array($newsresult)) {?><tr width=100%><td width="40%" align="left"><?php echo $row["date_format(date, '%m-%d-%Y')"]; ?>[/code] Link to comment https://forums.phpfreaks.com/topic/21213-help-using-date_format/ Share on other sites More sharing options...
Barand Posted September 18, 2006 Share Posted September 18, 2006 date_format is a SQL function an so needs to go in the query.[code]$newsquery = "SELECT id, author, title, article, date_format(date, '%m-%d-%Y') as dateFROM news order by date DESC LIMIT 0, 3";[/code]then[code]echo $row['date'];[/code] Link to comment https://forums.phpfreaks.com/topic/21213-help-using-date_format/#findComment-94313 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.