I am having the same problem, here is my code any suggestions?

<?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('"','&amp;rsquo;',$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/html; charset=UTF-8");
//header("Content-type: text/xml");;

// Start XML file, echo parent nodem
echo '<?xml version="1.0" encoding="UTF-8"'.'?'.'>';
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']) . '" ';
          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>";
}
?>

On Sunday, January 9, 2011 7:34:56 PM UTC-5, kseesee wrote:
>
>
>
> <?php 
> header("Content-type: text/xml"); 
> require("markersLogin.php"); 
> function parseToXML($htmlStr) 
> { 
> $xmlStr=str_replace('<','&lt;',$htmlStr); 
> $xmlStr=str_replace('>','&gt;',$xmlStr); 
> $xmlStr=str_replace('"','&quot;',$xmlStr); 
> $xmlStr=str_replace("&",'&amp;',$xmlStr); 
>
> $xmlStr=str_replace(" ' ",'&#146;',$xmlStr);      I tried adding this 
> line to replace any apostrophes but that didn't work.  Kinda lost.  I 
> HATE APOSTOPHE'S! 
>
> return $xmlStr; 
> } 
> // Get parameters from URL 
> $center_lat = $_GET["lat"]; 
> $center_lng = $_GET["lng"]; 
> $radius = $_GET["radius"]; 
> // Opens a connection to a mySQL server 
> $connection=mysql_connect($remote,$username,$password); 
> if (!$connection) { 
>   die('Not connected : ' . mysql_error()); 
> } 
>  mysql_select_db("geocourses") or die(mysql_error()); 
> // Select all the rows in the markers table 
> $query = sprintf("SELECT address, name, lat, lng, ( 6377 * 
> acos( cos( radians('%s') ) * cos( radians( lat ) ) * 
> cos( radians( lng ) - radians('%s') ) + sin( radians('%s') ) * 
> sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 
> '%s' ORDER BY distance LIMIT 0 , 30", 
>   mysql_real_escape_string($center_lat), 
>   mysql_real_escape_string($center_lng), 
>   mysql_real_escape_string($center_lat), 
>   mysql_real_escape_string($radius)); 
>
> $result = mysql_query($query); 
> if (!$result) { 
>   die('Invalid query: ' . mysql_error()); 
> } 
>
> // Start XML file, echo parent node 
> echo "<markers>\n"; 
> // Iterate through the rows, printing XML nodes for each 
> while ($row = @mysql_fetch_assoc($result)){ 
>   // ADD TO XML DOCUMENT NODE 
>   echo '<marker '; 
>   echo 'name="' . parseToXML($row['name']) . '" '; 
>   echo 'address="' . parseToXML($row['address']) . '" '; 
>   echo 'lat="' . $row['lat'] . '" '; 
>   echo 'lng="' . $row['lng'] . '" '; 
>   echo 'distance="' . $row['distance'] . '" '; 
>   echo "/>\n"; 
> } 
>
> // End XML file 
> echo "</markers>\n";

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API V2" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api/-/3V1j1YN693UJ.
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