You are here: Re: RSS feeds with PHP and MySQL? « PHP Programming Language « IT news, forums, messages
Re: RSS feeds with PHP and MySQL?

Posted by Zenbug on 09/07/05 00:09

Okay -- I wanted to be sure the question was appropriate for this group
first...

Essentially, I've had to modify the code in order to get any results
When I view my generated RSS feed in an RSS reader, I see a series of
items that are all titled "No Title", and they all contain no content.
I do know that it must be connecting to the database in some way,
because there are as many RSS items as there are news items in my
database. So I guess it's having a problem pulling out actual field
values.

Thanks for the help.
Here's my code as it is now:

<?
header('Content-type: text/xml');
?>

<rss version="2.0">
<channel>
<title>My title</title>
<description>My description</description>
<link>www.mysite.com</link>
<copyright>copyright information</copyright>

<?
$dbh=mysql_connect ("localhost", "user", "pass") or die ('I cannot
connect to the database because: ' . mysql_error());
mysql_select_db ("myDatabase");

$getItems="SELECT id, title, news FROM news ORDER BY id DESC";
$doGet=mysql_query($getItems);

while($item=mysql_fetch_array($doGet))
{
$id=$doGet['id'];
$title=($doGet['title']);
$news=($doGet['news']);
?>

<item>
<title><?print $title;?></title>
<description><?print $news;?></description>
<link>http://www.littlepilgrims.ca/</link>
</item>

<? } ?>
</channel>
</rss>

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация