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']) . '" ';
          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 view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api/-/0h1nrBq99FcJ.
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