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] Quote Link to comment 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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.