Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

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

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

New User

5+ Year Member

joined:Apr 10, 2010
posts: 1
votes: 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();
$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>";

so have i creat i RSS for that , i try like this
<?xml version='1.0' encoding='utf-8'?>
$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/'>
<title>MY world</title>
<description>Latest Posts at example.com</description>
<description>summary of the post</description>


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]

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

Moderator from CA 

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
votes: 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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members