Genesis730 Posted January 7, 2010 Share Posted January 7, 2010 Here is my code anyone know why the date doesn't get outputted onto my page? everything else does <?PHP $res = mysql_query("SELECT id, DATE_FORMAT(`date`, '%S %D %Y'), firstname, lastname, testimonial FROM testimonials ORDER BY date DESC LIMIT 10"); while ($row = mysql_fetch_assoc($res)) { echo "<b>{$row['firstname']} {$row['lastname']}</b><br />on {$row['date']}<br />{$row['testimonial']}<br /><br />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/ Share on other sites More sharing options...
oni-kun Posted January 7, 2010 Share Posted January 7, 2010 What is displayed in your database table for 'date'? Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990151 Share on other sites More sharing options...
Genesis730 Posted January 7, 2010 Author Share Posted January 7, 2010 i have 2 rows currently, 1 - 2009-09-29 06:25:38 2 - 2010-01-07 00:25:40 all that outputs is "on " Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990153 Share on other sites More sharing options...
topflight Posted January 7, 2010 Share Posted January 7, 2010 Also try: echo "<b>{$row[firstname]} {$row[lastname]}</b><br />on {$row[date]}<br />{$row[testimonial]}<br /><br />"; instead of this: echo "<b>{$row['firstname']} {$row['lastname']}</b><br />on {$row['date']}<br />{$row['testimonial']}<br /><br />"; Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990154 Share on other sites More sharing options...
PravinS Posted January 7, 2010 Share Posted January 7, 2010 Try this <?PHP $res = mysql_query("SELECT id, DATE_FORMAT(date, '%S %D %Y') as dt, firstname, lastname, testimonial FROM testimonials ORDER BY date DESC LIMIT 10"); while ($row = mysql_fetch_assoc($res)) { echo "<b>{$row['firstname']} {$row['lastname']}</b><br />on {$row['dt']}<br />{$row['testimonial']}<br /><br />"; } ?> If "date" is you field name then it should work. Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990155 Share on other sites More sharing options...
Genesis730 Posted January 7, 2010 Author Share Posted January 7, 2010 Right on pbs, thanks! Worked great =] Quote Link to comment https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990164 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.