Tuesday, December 11, 2012

[Google Maps API v2] Re: documentElement' is null or not an object

On Dec 11, 9:35 am, "raws4...@gmail.com" <raws4...@gmail.com> wrote:
> How do I change this on this code?
>
> <?php
> if (!isset($_SESSION)) {
> session_start();
>
> }
>
> require("../Connections/connLCEDC.php");
>
> function parseToXML($htmlStr)
> {
> $xmlStr=str_replace('<','&lt;',$htmlStr);
> $xmlStr=str_replace('>','&gt;',$xmlStr);
> $xmlStr=str_replace('"','&quot;',$xmlStr);
> $xmlStr=str_replace("'",'&#39;',$xmlStr);
> $xmlStr=str_replace("&",'&amp;',$xmlStr);
> return $xmlStr;
>
> }
>
> // 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_connLCEDC, $connLCEDC);
> if (!$db_selected) {
>   die ('Can\'t use db : ' . mysql_error());
>
> }
>
> // Select all the rows in the markers table
> //$query = "SELECT * FROM tblbldgs WHERE bldg_id = 6";
> //$result = mysql_query($query);
> $result = mysql_query($_SESSION["MM_QueryString"]);
> if (!$result) {
>   die('Invalid query: ' . mysql_error());
>
> }
>
> header("Content-type: text/xml");
>
> // Start XML file, echo parent nodem
> echo '<markers>';
>
> // Iterate through the rows, printing XML nodes for each
> if ($_SESSION["propType"] == "bldg") {
>     while ($row = @mysql_fetch_assoc($result)){
>         if ($row['bldg_latitude'] <> "" && $row['bldg_longitude'] <> "") {
>           // ADD TO XML DOCUMENT NODE
>           echo '<marker ';
>           echo 'name="' . parseToXML($row['bldg_name']) . '" ';

The code looks OK.

Looks like you have a data problem now.

XML Parsing Error: not well-formed
Location: http://www.lancasterscworks.com/includes/phpsqlajax_genxml3.php
Line Number 1, Column 1271.

>           echo 'overview="' . parseToXML($row['bldg_overview']) . '" ';
>           echo 'lat="' . $row['bldg_latitude'] . '" ';
>           echo 'lng="' . $row['bldg_longitude'] . '" ';
>           echo 'propType="' . $_SESSION["propType"] . '" ';
>           echo 'region="' . $row['bldg_region'] . '" ';
>           echo 'recordID="' . $row['bldg_id'] . '" ';
>           if ($row['bldg_image'] <> '') { // Show if recordset not empty
>             $image = "../images/bldgimgs/".$row['bldg_image'];
>             $strImage = makeImg($image);
>             echo 'thumb="' . parseToXML($strImage) . '" ';
>           }
>           echo '/>';
>         }
>     }
>     // End XML file
>     echo '</markers>';} elseif ($_SESSION["propType"] == "site") {
>
>     while ($row = @mysql_fetch_assoc($result)){
>         if ($row['site_latitude'] <> "" && $row['site_longitude'] <> "") {
>           // ADD TO XML DOCUMENT NODE
>           echo '<marker ';
>           echo 'name="' . parseToXML($row['site_name']) . '" ';
>           echo 'overview="' . parseToXML($row['site_overview']) . '" ';
>           echo 'lat="' . $row['site_latitude'] . '" ';
>           echo 'lng="' . $row['site_longitude'] . '" ';
>           echo 'propType="' . $_SESSION["propType"] . '" ';
>           echo 'region="' . $row['site_region'] . '" ';
>           echo 'recordID="' . $row['site_id'] . '" ';
>           if ($row['site_image'] <> '') { // Show if recordset not empty
>             $image = "../images/siteimgs/".$row['site_image'];
>             $strImage = makeImg($image);
>             echo 'thumb="' . parseToXML($strImage) . '" ';
>           }
>           echo '/>';
>         }
>     }
>     // End XML file
>     echo '</markers>';
>
> }
>
> // Resize images
> function makeImg($image) {
>    $hmax = 50; // max height
>    $wmax = 50; // max width
>    //$num = "300";
>    list($width, $height, $type, $attr) = getimagesize($image);
>    $hscale = $height / $hmax;
>    $wscale = $width / $wmax;
>    if (($hscale > 1) || ($wscale > 1)) {
>        $scale = ($hscale > $wscale)?$hscale:$wscale;
>    } else {
>        $scale = 1;
>    }
>    $newwidth = floor($width / $scale);
>    $newheight= floor($height / $scale);
>    $popwidth= $newwidth * 3;
>    $popheight= $newheight * 3;
>
>    //echo "$image: $newwidth x $newheight : $width x $height";
>
>    return "<img align=left width=$newwidth height=$newheight src=$image
> border=0>";}
>
> ?>

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate