Not sure what I am doing wrong? I keep getting the follow error…
Parse error: syntax error, unexpected ‘}’ in phpsqlajax_genxml.php on
line 63
When I remove the } I get an invalid $end?
Thanks for the help.
<?php
require("phpsqlajax_dbinfo.php");
header("Content-type: text/xml");
$filename = "hockey.xml";
$filetime = filemtime("$filename");
if (strtotime("+1 days", $filetime) < time()) {
$file = file_get_contents('hockey.xml');
echo $file;
} else {
// Start XML file, create parent node
$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);
// Opens a connection to a MySQL server
$connection = mysql_connect (localhost, $username, $password);
if (!$connection) {
die('Not connected : ' . mysql_error());
}
// Set the active MySQL database
$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 markers WHERE 1 AND lng != '' order by team asc";
$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("rinksize", $row['rinksize']);
$newnode->setAttribute("category", $row['category']);
}
echo $dom->saveXML();
$dom->save("hockey.xml")
}
?>
Add the semicolon after $dom->save(“hockey.xml”)