Trouble with a google map script [closed]

Learnewax

New Member
I'm trying to use this script from: https://developers.google.com/maps/articles/phpsqlajaxGoogle calls this script: phpsqlajax_genxml.phpI've checked the php_domxml extension and restarted my wampserver. I'm running php 5.2.9-2.I've defined $username, $password, and $database per instructions in a script called phpsqlajax_dbinfo.php.It's causing errors. Do you know what's causing these problems?Warning: domnode::append_child() expects parameter 1 to be object, null given in E:\wamp\www\phpsqlajax_genxml.php on line 7Notice: Use of undefined constant localhost - assumed 'localhost' in E:\wamp\www\phpsqlajax_genxml.php on line 10Notice: Undefined variable: username in E:\wamp\www\phpsqlajax_genxml.php on line 10Notice: Undefined variable: password in E:\wamp\www\phpsqlajax_genxml.php on line 10Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO) in E:\wamp\www\phpsqlajax_genxml.php on line 10 Not connected : Access denied for user 'ODBC'@'localhost' (using password: NO)` \[code\] // Start XML file, create parent node $doc = domxml_new_doc("1.0"); $node = $doc->create_element("markers"); $parnode = $doc->append_child($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"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Iterate through the rows, adding XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE $node = $doc->create_element("marker"); $newnode = $parnode->append_child($node); $newnode->set_attribute("name", $row['name']); $newnode->set_attribute("address", $row['address']); $newnode->set_attribute("lat", $row['lat']); $newnode->set_attribute("lng", $row['lng']); $newnode->set_attribute("type", $row['type']); } $xmlfile = $doc->dump_mem(); echo $xmlfile; ?> `\[/code\]
 
Back
Top