Hello, this is a follow up to my last post about a Flash message board... the last part is some php which parses the database to an xml format ready for flash to read.....
I can't get 's and "s to work properly though... they stop the code working, although they do seem to be working for the 'body' field for some reason :queasy:
Could anyone help me on this possibly??? I know it's somewhere in the last 10 lines or so...
<?php
#***********************************
# XML OUTPUT
#***********************************
define('********** , TRUE);
include('admin/functions.php');
$DBhost = "*******"; // Database Server
$DBuser = "*******"; // Database User
$DBpass = "*******"; // Database Pass
$DBName = "********"; // Database Name
// Connect to mySQL Server
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in News Application: " . mysql_error());
// Select mySQL Database
mysql_select_db($DBName, $DBConn) or die("Error in News Application: " . mysql_error());
$query = 'SELECT id, author, title, body, thedate, intro, FROM_UNIXTIME(timestamp, \'%M %D %Y\') date
FROM *********
LIMIT 20';
$result = mysql_query($query);
$nl = "\r\n";
echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . $nl;
echo '<ROOT>' . $nl;
while($r = mysql_fetch_array($result)){
$c = str_replace("´", "'", $r['author']);
$c = str_replace("´", "'", $r['date']);
$c = str_replace("´", "'", $r['title']);
$c = str_replace("´", "'", $r['intro']);
$c = str_replace("´", "'", $r['body']);
$c = str_replace("\n", "", $c);
echo '<news id="' . $r['id'] . '" title="' . stripslashes2($r['title']) . '" intro="' . stripslashes2($r['intro']) . '" date="' . $r['date'] . '" author="' . stripslashes2($r['author']) . '">' . $nl;
echo '<body><![CDATA[' . stripslashes2($c) . ']]></body>' . $nl;
echo '</news>' . $nl;
}
echo '</ROOT>' . $nl;
?>