Jump to content

RSS problem

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
Guest_Jaan_*

Guest_Jaan_*
  • Guests
Oookay.. another problemo.. maybe someone knows what's wrong with this code..

<?php

header("Content-Type: text/xml");

echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n\n";

echo "<!DOCTYPE rss PUBLIC \"-//Netscape Communications//DTD RSS 0.91//EN\"\n";

echo " \"http://my.netscape.com/publish/formats/rss-0.91.dtd\">\n\n";

echo "<rss version=\"0.91\">\n\n";

echo "<channel>\n";


mysql_connect("", "", "") or die("Ei saa ühendust andmebaasiga: ".mysql_error());

mysql_select_db("") or die("Ei saa valida andmebaasi: ".mysql_error());

$query2 = mysql_query("SELECT * FROM settings");

$row = mysql_fetch_array($query2);

$title = $row['title'];

$news =  $row['news'];


$query = mysql_query("SELECT * FROM news ORDER BY id LIMIT $news");


echo "<title>$title</title>\n";

echo "<link>http://sparta.et-resources.com</link>\n";

echo "<description>#Sparta.et News</description>\n";

while($row2 = mysql_fetch_array($query)){


$title = $row['title'];

$story = $row2['story'];


	echo "<item>\n";

	echo "<title>".$title."</title>\n";	

	echo "<link></link>";	

	echo "<description>".$story."</description>\n";

	echo "</item>\n\n";

}

echo "</channel>\n";

echo "</rss>";

?>

this $title and $story really.. work.. but in this rss feed it don't show anything.. i dunno why..

#Sparta.et

check it yourself

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
khm... anyone? :(

#3
John

John

    Writes binary right handed and hex left handed

  • Moderators
  • 6,321 posts
I don't know anything about RSS.

#4
TkTech

TkTech

    The Crazy One

  • Moderators
  • 1,396 posts
The code you have works perfectly - but one of your $stories that your printing out just before the closing </descriptions> tag doesn't close its <br> tag Rss is finiky, and since it doesn't find a closing tag, it takes the rest of the page as part of one entry, which is illegal, and it dies.

Debug message:
XML Parsing Error: mismatched tag. Expected: </br>.
Location: http://sparta.et-resources.com/rss.php
Line Number 16, Column 22:
<br>Greetz Fenriz..</description>
---------------------^


#5
Guest_Jaan_*

Guest_Jaan_*
  • Guests
dayum.. thanks ^^