Jump to content

brian0000

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

brian0000's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have found the problem. There was a space after the end of the php code in 'phpsqlajax_dbinfo.php' which was called from the above code. Taking away the space after the ?> solved the issue. Cheers
  2. Thanks Not sure if your line of code was to replace echo $dom->saveXML(); but I tried it both replacing that line of code and by adding the line of code below it and above it. Neither worked tosolve the problem. Thanks for the suggestion. Cheers
  3. My PHP code is generating XML with a blank first line before the <?xml version="1.0" ?> see http://urbanbees.co.uk/maps/phpsqlajax_genxml3.php I have been told this is the reason why my map is not showing the markers in chrome and FF but it is OK in IE8. see http://urbanbees.co.uk/maps/map_of_hive_locations_update.htm You'll either see markers or not depending on your broswer. How do I change the code to not generate this first blank line. Here is the php code. <?php require("phpsqlajax_dbinfo.php"); // 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"; $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 = $dom->createElement("marker"); $newnode = $parnode->appendChild($node); $newnode->setAttribute("name",$row['name']); $newnode->setAttribute("address", $row['address']); $newnode->setAttribute("lat", $row['lat']); $newnode->setAttribute("lng", $row['lng']); $newnode->setAttribute("type", $row['type']); } echo $dom->saveXML(); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.