...

View Full Version : Rss Feed from Mysql/PHP



jamesplato
04-10-2007, 04:39 AM
I am trying to pull a query from my mysql databse which will pull the last ten ads posted. I can't seem to get it work. any ideas?

here's the code




<?php
header("Content-Type: text/xml;charset=utf-8");
ECHO <<<END
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">

<channel>
<title>xxxxxxxxxxxx</title>
<description>xxxxxxxx</description>
<link>xxxxxxxxxx</link>

require(db_connect.php);

// Query database and select the last 10 entries.
$data = mysql_query('SELECT * FROM geodesic ORDER BY id DESC LIMIT 10');
while($row = mysql_fetch_array($data))
{


echo
<item>
<link>http://mysite.com/index.php?a=2&amp;b'.$row[id].'</link>
<guid isPermaLink='true'>http://mysite.com/index.php?a=2&amp;b'.$row[id].'</guid>
<title>'.$row[title].'</title>
<description><![CDATA['.$row[description].']]></description>
</item>';
}

echo

</channel>
</rss>
END;

?>


I am trying to get the output to just list the title and the description form my SQL database. The script above validated fine, but no query from the MYSQL shows up :(

thanks to everyone!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum