Hey all. I'm trying to save A XML file using php. here is my code, the connection to the DB is okay and all, i can use $dom->saveXML() but the save function isn't saving nothing. please help.
<?
$db_selected = mysql_select_db($database, $connection);
if (!$db_selected) {
die ('Can\'t use db : ' . mysql_error());
}
// Select all the rows in the markers table
$query = "SELECT * FROM Listing_Arnona WHERE 1";
$result = mysql_query($query);
if (!$result) {
die('Invalid query: ' . mysql_error());
}
// Iterate through the rows, adding XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
// ADD TO XML DOCUMENT NODE
$node = $dom->createElement("marker");
$newnode = $parnode->appendChild($node);
$newnode->setAttribute("Price",$row['Price']);
$newnode->setAttribute("PriceS", $row['Price']);
$newnode->setAttribute("address", $row['street_name']);
$newnode->setAttribute("NumRooms", $row['Room_Num']);
$newnode->setAttribute("PROMO", $row['PROMO']);
}
$dom->formatOutput = true;
$test1 = $dom->saveXML(); // put string in test1
$dom->save('test1.xml'); // save as file
?>
test1.xml? Are you able to successfully output$test1to the browser?$dom->save('test1.xml')return? If it returnsfalse, it can't write the file (and most probably that is a permissions issue).isn't saving nothing? Ah, gotta love them double negatives. What is it saving?