Flames Posted October 19, 2008 Share Posted October 19, 2008 Trying to convert the mysql date from yyyy-mm-dd to 1st Jan 08. this is my code but it doesnt work. <?php require_once("connect.php"); mysql_select_db($db['db'], $con) or die("Couldn't connect to Database"); $sql = "SELECT *, DATE_FORMAT(date, %d %b %y) FROM News ORDER BY id DESC LIMIT 1"; $query = mysql_query($sql); while($news = mysql_fetch_assoc($query)) { $message = $news['message']; $poster = $news['poster']; $date = $news['date']; } echo <<<EOT $message, posted by <span class="poster">$poster</span>, on the <span class="style7">$date</span> EOT; ?> i get this error Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/a6474246/public_html/index.php on line 36 Help? Link to comment https://forums.phpfreaks.com/topic/129113-mysql-date_format-help/ Share on other sites More sharing options...
AndyB Posted October 19, 2008 Share Posted October 19, 2008 No. You already have this same topic as an open thread where you have been given the answer. Thread locked. Link to comment https://forums.phpfreaks.com/topic/129113-mysql-date_format-help/#findComment-669325 Share on other sites More sharing options...
Recommended Posts