Jump to content

MySQL date_format help


Flames

Recommended Posts

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
Share on other sites

Guest
This topic is now 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.