|
Posted by Zenbug on 09/07/05 07:28
You're right; there was an error in the tutorial. Seems to be working
now.
Thanks again everyone!
--ZenBug
Malcolm Dew-Jones wrote:
> Zenbug (zenbug@gmail.com) wrote:
> : 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']);
>
>
> Surely that should be $id=$item['id'], $title=$item['title'], etc.
> ^^^^^ ^^^^^
>
> Off topic, but I think that <?php tags are prefered. All php servers
> suport them, whereas <? only works on some servers, so it's a best habit
> to simply use <?php and be done with it.
>
>
>
> --
>
> This programmer available for rent.
Navigation:
[Reply to this message]
|