[RSS] Problem z odczytywaniem z bazy
: pn mar 13, 2006 5:24 pm
Mam taki dokument o nazwie rsschannel.php:
[php]
<?php echo "<?xml version='1.0' encoding='utf-8'"; ?>
<rss version='2.0'>
<channel>
<title>Newsy MUnited.prv.pl</title>
<description>Kanał RSS do newsów poświęconych Manchester United.</description>
<link>http://www.munited.prv.pl</link>
<language>pl</language>
<copyright>MUnited.prv.pl</copyright>
<managingEditor>[email protected]</managingEditor>
<webMaster>[email protected]</webMaster>
<pubDate>Mon, 6 Mar 2006 23:45:09 +0100</pubDate>
<lastBuildDate>Tue, 7 Mar 2006 16:08:20 +0100</lastBuildDate>
<generator>Pajaczek NxG PRO v5.5.1</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<ttl>10</ttl>
<?php
include "admin/config.php";
@ $polaczenie = mysql_pconnect($host, $db_user, $db_pass);
if (!$polaczenie)
{
echo "Nie udało się nawiązać połączenia z serwerem.";
exit;
}
mysql_select_db($db);
mysql_query("SET NAMES 'utf8'");
$sql = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 0, 10");
$ile = mysql_num_rows($sql);
for($a=0; $a<$ile; $a++) {
$wiersz = mysql_fetch_array($sql);
$id = stripslashes($wiersz['id']);
$data = stripslashes($wiersz['data']);
$dodal = stripslashes($wiersz['dodal']);
$tytul = stripslashes($wiersz['tytul']);
$tresc = stripslashes($wiersz['tresc']);
$tresc = substr($tresc, 0, 255);
echo "<item>
<title>$tytul</title>
<description>$tresc...</description>
<link>http://localhost/~ja/index.php?id=$id</link>
<author>$dodal</author>
</item>";
}
?>
</channel>
</rss>
[/php]
Po wklepaniu adresu dokuemntu do przeglądarki pojawia mi się coś takiego:
http://majzer.kero.pl/blad.jpg
Pytanie: Gdzie mam błąd???
[php]
<?php echo "<?xml version='1.0' encoding='utf-8'"; ?>
<rss version='2.0'>
<channel>
<title>Newsy MUnited.prv.pl</title>
<description>Kanał RSS do newsów poświęconych Manchester United.</description>
<link>http://www.munited.prv.pl</link>
<language>pl</language>
<copyright>MUnited.prv.pl</copyright>
<managingEditor>[email protected]</managingEditor>
<webMaster>[email protected]</webMaster>
<pubDate>Mon, 6 Mar 2006 23:45:09 +0100</pubDate>
<lastBuildDate>Tue, 7 Mar 2006 16:08:20 +0100</lastBuildDate>
<generator>Pajaczek NxG PRO v5.5.1</generator>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<ttl>10</ttl>
<?php
include "admin/config.php";
@ $polaczenie = mysql_pconnect($host, $db_user, $db_pass);
if (!$polaczenie)
{
echo "Nie udało się nawiązać połączenia z serwerem.";
exit;
}
mysql_select_db($db);
mysql_query("SET NAMES 'utf8'");
$sql = mysql_query("SELECT * FROM `news` ORDER BY `id` DESC LIMIT 0, 10");
$ile = mysql_num_rows($sql);
for($a=0; $a<$ile; $a++) {
$wiersz = mysql_fetch_array($sql);
$id = stripslashes($wiersz['id']);
$data = stripslashes($wiersz['data']);
$dodal = stripslashes($wiersz['dodal']);
$tytul = stripslashes($wiersz['tytul']);
$tresc = stripslashes($wiersz['tresc']);
$tresc = substr($tresc, 0, 255);
echo "<item>
<title>$tytul</title>
<description>$tresc...</description>
<link>http://localhost/~ja/index.php?id=$id</link>
<author>$dodal</author>
</item>";
}
?>
</channel>
</rss>
[/php]
Po wklepaniu adresu dokuemntu do przeglądarki pojawia mi się coś takiego:
http://majzer.kero.pl/blad.jpg
Pytanie: Gdzie mam błąd???