Jump to content

Date doesn't display :(


Genesis730

Recommended Posts

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 />";
}
?>

Link to comment
https://forums.phpfreaks.com/topic/187534-date-doesnt-display/
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/187534-date-doesnt-display/#findComment-990155
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.