rss feed from mysql help
Posted: Thu Nov 04, 2010 7:44 pm
hello
does anyone know why this isnt showing a feed with any data?
im new to rss and am stuggling!
if someone could correct the code for me id thank them a thousand times!!
any help or guidance would be apreciated.
does anyone know why this isnt showing a feed with any data?
im new to rss and am stuggling!
if someone could correct the code for me id thank them a thousand times!!
Code: Select all
<? header('Content-type: text/xml'); ?>
<rss version="2.0">
<channel>
<title>Name of your site</title>
<description>A description of your site</description>
<link>http://your_home_page_url/</link>
<copyright>Your copyright information</copyright>
<?
$hostname='****'; //// specify host, i.e. 'localhost'
$user='****'; //// specify username
$pass='****'; //// specify password
$dbase='*****'; //// specify database name
$connection = mysql_connect("$hostname" , "$user" , "$pass")
or die ("Can't connect to MySQL");
$db = mysql_select_db($dbase , $connection) or die ("Can't select database.");
$q="SELECT id,jobname,description,postdate FROM jobmodule LIMIT 0,15 ORDER BY postdate DESC";
$doGet=mysql_query($q);
while($result = mysql_fetch_array($doGet)){
?>
<item>
<title> <?=htmlentities(strip_tags($result['jobname'])); ?></title>
<description> <?=htmlentities(strip_tags($result['description'],'ENT_QUOTES'));?></description>
<link>http://yoururl.com/pathtostory/and_page.php?p=<?=$result['id'];?></link>
<pubDate> <?=strftime( "%a, %d %b %Y %T %Z" , $result['postdate']); ?></pubDate>
</item>
<? } ?>
</channel>
</rss>