Thanks, I did actually try all 3 types of file and none of them
worked. I just didnt realise that PHP4 had changed in 5. I went back
over the tutorial. This time looking into phpsqlajax_genxml3.php as i
said i did try all 3 files intially. I just assumed i hadnt got it
right so picked one file to try and rectify. When using
phpsqlajax_genxml3.php I just get a blank output, My db is all
connected ok as i echoed out some details from it. But my page is just
blank. (Bar the header warning) :-( I'm really not supid, but i cant
see how I can be getting this wrong, all i'm doing its taking the code
from google and loading it on my server. This is my code (not that you
really need it as its off google itself)

<?php
require('connect.php');
?>

<?php

// Start XML file, create parent node

$dom = new DOMDocument("1.0");
$node = $dom->createElement("markers");
$parnode = $dom->appendChild($node);

// 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();

?>


On Aug 19, 7:00 pm, Rossko <[email protected]> wrote:
> > would anyone know what the problem is?
>
> The example is written to use PHP4 DOM XML extension.
> The article 
> sayshttp://code.google.com/apis/maps/articles/phpsqlajax.html#outputxml
> "Check your configuration or try initializing a domxml_new_doc() to
> determine if your server's PHP has dom_xml functionality on."
> The article offers alternative advice further down in the case
> "If you don't have access to PHP's dom_xml functions, ...."
> and provides an alternative method which will work in PHP5
>
> PHP reference for DOM XML sayshttp://www.php.net/manual/en/intro.domxml.php
> "This extension ... never be released with PHP 5, and will only be
> distributed with PHP 4. If you need DOM XML support with PHP 5 you can
> use the DOM extension. This domxml extension is not compatible with
> the DOM extension."
>
> It's not a fault in the example, which does provide a method that will
> work  in PHP5.  As the v2 API is now deprecated I doubt Google will be
> looking to revise the example with PHP5 methods.
>
> There's nothing to stop you adapting the example to work with DOM
> rather than DOM XML,  which is what you are already doing of course,
> but it is up to you to do it  There is help out there for that 
> taskhttp://www.google.com/search?q=php5+domxml+conversion
>
> There are old threads about it 
> allhttp://groups.google.com/group/google-maps-api/search?group=google-ma...

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-api?hl=en.

Reply via email to