homepage Welcome to WebmasterWorld Guest from 50.19.206.49
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
i have PHP script how i can creat RSS , help me please
anzorgar




msg:4113414
 4:38 am on Apr 10, 2010 (gmt 0)

hi dear

i have i small open soruce php script its can show the titles like this .

<?
$query = "SELECT * FROM roseNews where newscat in(4)ORDER BY newsdate DESC,newsid DESC limit 5" ;
$result= mysql_query($query);
if(!$result)echo mysql_error();
while($row=mysql_fetch_array($result))
{
$id= $row["newsid"];
$date = $row["newsdate"];
$title= $row["newsheadline"];
?>
<?
echo "<div>$date</div><div><A class=Afghannews href='details.php?id=$id'>$title</A></div>";
?>
<?}?>
</div>


so have i creat i RSS for that , i try like this
<?xml version='1.0' encoding='utf-8'?>
<?php
$query = "SELECT * FROM roseNews where newscat='44' ORDER BY newsdate DESC,newsid DESC limit 18" ; $result= mysql_query($query); if(!$result)echo mysql_error(); while($row=mysql_fetch_array($result)){
$id= $row["newsid"];
$date = $row["newsdate"];
$title= $row["newsheadline"];
}?>
<rss version='2.0' xmlns:dc='http://purl.org/dc/elements/1.1/'>
<channel>
<title>MY world</title>
<link>rss.php</link>
<description>Latest Posts at example.com</description>
<language>ar-sa</language>
<item>
<pubDate>{$date}</pubDate>
<title>{$title}</title>
<link>details.php?id=$id</link>
<guid>details.php?id=$id</guid>
<description>summary of the post</description>
</item>

</channel>
</rss>


but its dosnt work

pleasse write for me the coract codes

[edited by: eelixduppy at 2:51 pm (utc) on Apr 12, 2010]
[edit reason] exemplified [/edit]

 

httpwebwitch




msg:4114100
 4:35 am on Apr 12, 2010 (gmt 0)

What you've got there is full of problems

There's a while loop which assigns values to $id and $date and $title, but I'd expect you want the same loop to create your <item> nodes. It's not doing that.

also, putting {$date} around a variable name doesn't print the value of $date.

I'm going to move this post over to the PHP forum

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved