making XML from database using PHP

p30lord.net

New Member
I am Using the code below to make an VERY LARGE XML file from a database The code is not written by me its written by Jubba available at KirupaWell the problem is that everything is well formed but like around 30 '<' symbols in the output XML file are missing..so for example output would be something like this..\[code\]<XYZ> <ab>123333</ab> <resource>http://xxx.com</resource> /XYZ> /* no '<' */\[/code\]The code used is:
\[code\]header("Content-type: text/xml"); $host = "localhost"; $user = "root"; $pass = ""; $database = "test"; $linkID = mysql_connect($host, $user, $pass) or die("Could not connect to host."); mysql_select_db($database, $linkID) or die("Could not find database."); $query = "SELECT * FROM blog ORDER BY date DESC"; $resultID = mysql_query($query, $linkID) or die("Data not found."); $xml_output = "<?xml version=\"1.0\"?>\n"; $xml_output .= "<entries>\n"; for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){ $row = mysql_fetch_assoc($resultID); $xml_output .= "\t<entry>\n"; $xml_output .= "\t\t<date>" . $row['date'] . "</date>\n"; // Escaping illegal characters $xml_output .= "\t\t<text>" . $row['text'] . "</text>\n"; $xml_output .= "\t</entry>\n"; } $xml_output .= "</entries>"; echo $xml_output; ?>\[/code\]Can u suggest me what the reason might be for the error??
 
Top