Fuego
11-24-2004, 07:31 PM
Trying to create a xml with PHP, i just spent the whole day finding this
out but I cant find the thing Im doing wrong...
This code will run, it does validate with no problems but
when i run this im seeing a blank page with the rss code
in the source of the page.
<?php
$rss .= "<rss version=\"1.0\">\n";
$rss .= "<channel>\n";
if(!$dbconnect = mysql_connect(xxxxxxxxx)) {
echo "Connection failed to the host 'localhost'.";
exit;
} // if
if (!mysql_select_db(xxxxxxxxxx)) {
echo "Cannot connect to database 'test'";
exit;
} // if
$table_id = 'mednet.doc';
/* Make database query */
$query = "SELECT * FROM $table_id where teksttype = 'Nieuws Bericht' limit 1";
$dbresult = mysql_query($query, $dbconnect);
while($logs=mysql_fetch_array($dbresult)) {
$logs = str_replace("<", "<", $logs);
$logs = str_replace(">", ">", $logs);
$logs = str_replace("\\", "", $logs);
$rss .= "<item>\n";
$rss .= "<title>".$logs['naam']."</title>\n";
$rss .= "<description><![CDATA[".$logs['inhoud']."]]></description>\n";
$rss .= "</item>\n";
} $rss .= "</channel>\n";
$rss .= "</rss>";
echo($rss);
?>
out but I cant find the thing Im doing wrong...
This code will run, it does validate with no problems but
when i run this im seeing a blank page with the rss code
in the source of the page.
<?php
$rss .= "<rss version=\"1.0\">\n";
$rss .= "<channel>\n";
if(!$dbconnect = mysql_connect(xxxxxxxxx)) {
echo "Connection failed to the host 'localhost'.";
exit;
} // if
if (!mysql_select_db(xxxxxxxxxx)) {
echo "Cannot connect to database 'test'";
exit;
} // if
$table_id = 'mednet.doc';
/* Make database query */
$query = "SELECT * FROM $table_id where teksttype = 'Nieuws Bericht' limit 1";
$dbresult = mysql_query($query, $dbconnect);
while($logs=mysql_fetch_array($dbresult)) {
$logs = str_replace("<", "<", $logs);
$logs = str_replace(">", ">", $logs);
$logs = str_replace("\\", "", $logs);
$rss .= "<item>\n";
$rss .= "<title>".$logs['naam']."</title>\n";
$rss .= "<description><![CDATA[".$logs['inhoud']."]]></description>\n";
$rss .= "</item>\n";
} $rss .= "</channel>\n";
$rss .= "</rss>";
echo($rss);
?>