For some weird reason I keep getting this error but it's writing to the xml file with no problems. But I'm tired of this error showing up.
Here is the code
<?php
include( 'connection.php' );
header('Content-type: text/xml');
$linkID = mysql_connect($dbhost, $dbuser, $dbpass) or die("Could not connect to host.");
mysql_select_db($dbname, $linkID) or die("Could not find database.");
$query = "SELECT * FROM $table ORDER BY id DESC";
$resultID = mysql_query($query, $linkID) or die("Data not found.");
$xml_output = "<?xml version=\"1.0\"?>\n";
$xml_output .= "<title>\n";
for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
$row = mysql_fetch_assoc($resultID);
$xml_output .= "\t<goodlife_locations>\n";
$xml_output .= "\t\t<id>" . $row['id'] . "</id>\n";
// Escaping illegal characters
$row['text'] = str_replace("&", "&", $row['text']);
$row['text'] = str_replace("<", "<", $row['text']);
$row['text'] = str_replace(">", ">", $row['text']);
$row['text'] = str_replace("\"", """, $row['text']);
$xml_output .= "\t\t<goodlife_loc>" . $row['goodlife_loc'] . "</goodlife_loc>\n";
$xml_output .= "\t\t<address>" . $row['address'] . "</address>\n";
$xml_output .= "\t</goodlife_locations>\n";
}
$xml_output .= "</title>";
$filenamepath .= "xml/locations.xml";
$fp = fopen($filenamepath,'w');
$write = fwrite($fp,$xml_output);
echo "$xml_output";
mysql_close();
?>
<a herf='index.php>Back to Main</a>
I've also attached a screen shot. As well. I used to have a javascript in there that would re-direct the page back to index.php in like 2 seconds to that people don't see the xml thing come up.
Thing is kinda weird though. Cause like 2 years ago I used the same thing to do the same exact thing and I had zero problems.
Only difference is server. But both servers were setup by me using LAMP.
Final Notes: It works but I just get the error that pops up.
Thanks in advance,