MySQL Forums
Forum List  »  PHP

php 4 and mysql date formatting for rss 2
Posted by: Steve A
Date: February 26, 2006 05:05AM

Ok this looks as though it would be easyer to do in php 5 put I'm stuck with php 4

I'm trying to get my dates to look like the rss v 2.0 recomendation
It should look a bit like this
Tue, 03 Jun 2003 09:39:21 GMT

<code> Example 1 (works) but is the wrong formatt
<?php

include "passwords.php";
$db = mysql_connect("$db_host","$db_user","$db_pass");
mysql_select_db ("$db_name");
$result = mysql_query("select date_create from news");
$total = mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result))
{
echo "<br>";
echo $myrow["date_create"];
echo "<br>";
echo "<hr>";
}

?>


<code> Example 2 Does not work

<?php
include "passwords.php";
$db = mysql_connect("$db_host","$db_user","$db_pass");
mysql_select_db ("$db_name");
$result = mysql_query("select date_create from news");
$total = mysql_num_rows($result);
while ($myrow = mysql_fetch_array($result))
{
echo "<br>";
echo DATE("r","$myrow[date_create]");
echo "<br>";
echo "<hr>";
}

?>
</code>

Anyone have any idea on what I'm missing out on?

Thanks

Steve

Options: ReplyQuote


Subject
Written By
Posted
php 4 and mysql date formatting for rss 2
February 26, 2006 05:05AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.