I hope someone can help me out, with this.
I am getting data from a MySql database via php and outputting it into xml.
Here is my code:
<?
include("connect.php");
header("Content-type: text/xml");
$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 head_entry, text_entry, DATE_FORMAT(add_date, '%d %b %Y, %H:%i') as vtime FROM newsbox WHERE active = 'y' ORDER BY add_date DESC";
$result = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>
";
$xml_output .= "<menu>
";
for ($x = 0; $x < mysql_num_rows($result) ; $x++){
$row = mysql_fetch_assoc($result);
$xml_output .= " <item head =\"" . "<b>" . $row['head_entry'] . "</b>" . "\" entry =\"" . $row['text_entry'] . "\" date =\"" . $row['vtime'] . "\" >
";
$xml_output .= " </item>
";
}
$xml_output .= "</menu>";
print $xml_output;
?>
My problem is that i need to have links, bold and italic in there. How would i get php to detect <b></b>, <i></i>, <a href=></a> and change it so xml can understand it and output the result correctly.
Would i have to use CDATA and if so, how???
Cheers
Lee