Posted by it on 12/19/07 12:18
Hi
I am creating an XML output using php but get a error because the data
in the description field is outputing a link which is: <a HREF="HTTP://
WWW.PASTETHEWALL.CO.UK">Paste the wall</A>.
Below is the script I'm using, new to php and not sure how to get
round this hope someone can help. Thanks in advance..........
<?php
$dbhost = '';
$dbuser = '';
$dbpass = '';
$dbname = '';
mysql_connect($dbhost, $dbuser, $dbpass) or die("I could not connect
to database");
mysql_select_db($dbname) or die (mysql_error());
header('Content-type: text/xml');
echo '<?xml version=\'1.0\' encoding=\'UTF-8\'?>';
echo '
<products xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:nonamespaceschemalocation="schema">';
// Start the XML
$data = mysql_query("select * from products ORDER BY description");
while($row = mysql_fetch_array($data))
{
echo '
<product id="'.$row['description'].'">
</product>';
}
echo '
</products>';
?>
[Back to original message]
|