Hello,
I'm using Google Maps to show houses listings on the Google map. I'm also using AJAX to allow user to customize search parameters. Map is showing fine but the houses listings on the map is not working. Moreover, I'm getting the following pop up error;

http://imageshack.us/photo/my-images/857/screenshotpll.png/

I'm also sharing the results.php code. Any kind of help will be really appreciated.

<?php

define("Database_Host","localhost");
define("Database_Login","root");
define("Database_Password","");
define("Database","alex");

$db = mysql_connect(Database_Host,Database_Login, Database_Password);
mysql_select_db(Database, $db);

echo '{';
echo '"JSON":';

if(is_numeric($_GET['low']))
{
	$low = $_GET['low'];
}
else
{
	echo '""}';
	exit;
}

$alex_query = "SELECT matrix_unique_ID,price_current,lat,lng,street_no,street,street_suffix,district,tot_sqft_finished,tot_sqft_unfinished,bedrooms,total_baths,LA_first_name,LA_last_name,listing_subtype,remarks FROM alex_listings WHERE price_current >= ".$low." AND (price_current != 'SOLD!')";
$remax_query = "SELECT matrix_unique_ID,price_current,lat,lng,street_no,street,street_suffix,district,tot_sqft_finished,tot_sqft_unfinished,bedrooms,total_baths,LA_first_name,LA_last_name,listing_subtype,remarks FROM remax_listings WHERE price_current >= ".$low." AND (LA_last_name != 'Burns' && LA_first_name != 'Alex') AND (LA_last_name != 'Tyler' && LA_first_name != 'Trina')";

if(is_numeric($_GET['high']))
{
	$high = $_GET['high'];
	if($high < 1000000)
	{
		$alex_query .= " AND price_current <= ".$high;
		$remax_query .= " AND price_current <= ".$high;
	}
}

if(is_numeric($_GET['bed']))
{
	$alex_query .= " AND bedrooms >= ".$_GET['bed'];
	$remax_query .= " AND bedrooms >= ".$_GET['bed'];
}

if(is_numeric($_GET['bath']))
{
	$alex_query .= " AND total_baths >= ".$_GET['bath'];
	$remax_query .= " AND total_baths >= ".$_GET['bath'];
}

if(is_numeric($_GET['sqft']))
{
	$alex_query .= " AND (tot_sqft_finished + tot_sqft_unfinished) >= ".$_GET['sqft'];
	$remax_query .= " AND (tot_sqft_finished + tot_sqft_unfinished) >= ".$_GET['sqft'];
}

if($_GET['manufactured'] == "false")
{
	$alex_query .= " AND listing_subtype != 'Manu Double-Wide'";
	$alex_query .= " AND listing_subtype != 'Manu Single-Wide'";
	$remax_query .= " AND listing_subtype != 'Manu Double-Wide'";
	$remax_query .= " AND listing_subtype != 'Manu Single-Wide'";
}

if($_GET['multi_unit'] == "false")
{
	$alex_query .= " AND listing_subtype != 'Strata Duplex Unit'";
	$alex_query .= " AND listing_subtype != 'Revenue Triplex'";
	$alex_query .= " AND listing_subtype != 'Revenue 4-Plex'";
	$remax_query .= " AND listing_subtype != 'Strata Duplex Unit'";
	$remax_query .= " AND listing_subtype != 'Revenue Triplex'";
	$remax_query .= " AND listing_subtype != 'Revenue 4-Plex'";
}

if($_GET['condos'] == "false")
{
	$alex_query .= " AND listing_subtype != 'Condo Apartment'";
	$remax_query .= " AND listing_subtype != 'Condo Apartment'";
}

if($_GET['townhouses'] == "false")
{
	$alex_query .= " AND listing_subtype != 'Townhouse'";
	$remax_query .= " AND listing_subtype != 'Townhouse'";
}

if($_GET['houses'] == "false")
{
	$alex_query .= " AND listing_subtype != 'Single Family Detached'";
	$remax_query .= " AND listing_subtype != 'Single Family Detached'";
}
	
if($_GET['alexlistings'] != "false" && $_GET['remaxlistings'] != "false")
	$query = $alex_query." UNION ".$remax_query;
else if($_GET['alexlistings'] != "false")
	$query = $alex_query;
else if($_GET['remaxlistings'] != "false")
	$query = $remax_query;
else
{
	echo '""}';
	exit;
}

$query .= " ORDER BY 2";

$results = mysql_query($query);
while($row = mysql_fetch_array($results))
	if(!($row["lat"]) || !($row["lng"])){
	}else
		$rows[] = $row;

if(count($rows) > 0)
{
	$echo .= '[';
	foreach ($rows as $row)
	{
		$sqft = $row["tot_sqft_finished"] + $row["tot_sqft_unfinished"];
		$address = $row["street_no"]." ".$row["street"]." ".$row["street_suffix"];
		$alt = $row["street_no"]." ".$row["street"]." ".$row["street_suffix"].", ".$row["district"].", B.C.";
		$remarks = substr($row["remarks"], 0, strrpos(substr($row["remarks"], 0, 200), ' ')) . '...';

		$echo .= '{';
		$echo .= '"matrix_unique_ID": "'.$row["matrix_unique_ID"].'",';
		$echo .= '"lat": "'.$row["lat"].'",';
		$echo .= '"lng": "'.$row["lng"].'",';
		$echo .= '"street_no": "'.$row["street_no"].'",';
		$echo .= '"street": "'.$row["street"].'",';
		$echo .= '"street_suffix": "'.$row["street_suffix"].'",';
		$echo .= '"district": "'.$row["district"].'",';
		$echo .= '"price_current": "'.$row["price_current"].'",';
		$echo .= '"bedrooms": "'.$row["bedrooms"].'",';
		$echo .= '"sqft": "'.$sqft.'",';
		$echo .= '"total_baths": "'.$row["total_baths"].'",';
		$echo .= '"LA_first_name": "'.$row["LA_first_name"].'",';
		$echo .= '"LA_last_name": "'.$row["LA_last_name"].'",';
		$echo .= '"listing_subtype": "'.$row["listing_subtype"].'",';
		$echo .= '"address": "'.$address.'",';
		$echo .= '"remarks": "'.$remarks.'",';
		$echo .= '"alt": "'.$alt.'"';
		$echo .= '},';
	}
	echo substr($echo,0,-1).']}';
}
else
{
	echo '""}';
}
	
mysql_close($db);
	
?>

The following is the code of main file - simple.php;

<?php session_start();

define("Database_Host","localhost");
define("Database_Login","root");
define("Database_Password","");
define("Database","alex");
define("Alex_Database_Table","alex_listings");
define("Alex_Images_Folder","alex_listings/images");
define("ReMax_Database_Table","remax_listings");
define("ReMax_Images_Folder","remax_listings/images");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="author" content="mike@mikeraydesign.ca" />
  <meta name="owner" content="alex@alexburns.ca" />
  <meta name="subject" content="Victoria BC Real Estate Agent" />
  <meta name="abstract" content="Alex Burns &amp; Associates is one of Victorias leading edge Real Estate offices.  Alex and his team serve their clients with innovative marketing strategies and superior customer service.  Alex's team has years of expertise in the Real Estate industry, and actively seeks out business for their clients - whether they be buyers or sellers." />
  <meta name="keywords" content="Real Estate, Real Estate Victoria, Victoria, Victoria BC, Alex Burns, ReMax, ReMax Camosun, ReMax Victoria, Victoria Real Estate, Real Estate market, Victoria homes, Victoria homes for sale, Victoria houses for sale, houses for sale, homes for sale, for sale by owner, FSBO, buy with zero down, buy a home, selling houses in Victoria, property Victoria, Victoria property, waterfront property, Victoria waterfront property, Victoria condos, Victoria condominiums" />
  <meta name="language" content="en" />
  <meta name="copyright" content="Alex Burns &amp; Associates" />
  <meta name="robots" content="all" />
  <meta http-equiv="imagetoolbar" content="no" />

  <link href="http://www.alexburns.ca/favicon.ico" rel="shortcut icon" />
  
  <meta name="description" content="ReMax Camosun carries more Victoria Real Estate listings than any other Real Estate brokerage in the Greater Victoria Area. All for sale listings are posted by their selling location within the surrounding area of Greater Victoria." />
  
  <title>Full Screen Victoria MLS Real Estate Listings | Alex Burns &amp; Associates - Victoria, BC, Canada</title>

  <link href="Scripts/jquery-ui-1.8.4.custom.css" rel="stylesheet" type="text/css" />
  <link href="Scripts/main.css" rel="stylesheet" type="text/css" />
  
  <script type="text/javascript" src="Scripts/jquery-1.4.2.min.js"></script>
  <script type="text/javascript" src="Scripts/jquery-ui-1.8.4.custom.min.js"></script>
  <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
  <script type="text/javascript" src="Scripts/search.js"></script>
  <script type="text/javascript" src="Scripts/map.js"></script>
  <script type="text/javascript" language="javascript">
<!--
sessionvar = new String("<?php echo $_SESSION['username']; ?>");
-->
  </script>
  
  <style type="text/css">
	html,body {height:100%;width:100%;}
  </style>
</head>
<body>

<div class="fullscreen_bar">
  <table border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td width="50%"></td>
      <td>
	    <table cellpadding="0" cellspacing="0" border="0">
          <tr>
            <td><img src="structure-images/text-holder-top.png" alt="Victoria Real Estate Information header" /></td>
          </tr>
          <tr>
            <td class="maintext">
            
              <div style="position:relative;">
                <h1 style="margin-bottom:10px;">Customize your Home Search Parameters</h1>

	            <div style="position: absolute; right:-15px; top:-20px; width:450px; font-size:14px; color:#B42128; font-weight:bold;">
                  <div style="float:left; width:249px;">
                    <input id="alexlistings" type="checkbox" checked="checked" onClick="Do_AJAX_Search();" /><label for="alexlistings">Alex Burns &amp; Associates Listings</label><br />
                    <input id="remaxlistings" type="checkbox" checked="checked" onClick="Do_AJAX_Search();" /><label for="remaxlistings">ReMax Camosun Listings</label>
                  </div>
                  <div style="width:1px; height: 100px; margin-top:15px; margin-left:5px; margin-right:5px; background-color:#FFFFFF; float:left;">&nbsp;</div>
                  <div style="float:right; width:190px;">
                    <table cellpadding="2" cellspacing="0" border="0">
                      <tr>
                        <td><input id="manufactured" type="checkbox" onClick="Do_AJAX_Search();" /></td>
                        <td align="center"><img src="structure-images/manufactured.gif" alt="Manufactured and Mobile Homes" /></td>
                        <td><label for="manufactured">Manufactured</label></td>
                      </tr>
                      <tr>
                        <td><input id="multi_unit" type="checkbox" onClick="Do_AJAX_Search();" /></td>
                        <td align="center"><img src="structure-images/small-multi.gif" alt="Duplex, Triplex, 4-Plex Units for Sale" /></td>
                        <td><label for="multi_unit">Multi-Unit</label></td>
                      </tr>
                      <tr>
                        <td><input id="condos" type="checkbox" onClick="Do_AJAX_Search();" /></td>
                        <td align="center"><img src="structure-images/small-condo.gif" alt="Condos and Condominiums for Sale" /></td>
                        <td><label for="condos">Condos</label></td>
                      </tr>
                      <tr>
                        <td><input id="townhouses" type="checkbox" onClick="Do_AJAX_Search();" /></td>
                        <td align="center"><img src="structure-images/small-townhouse.gif" alt="Townhouses and Victoria Strata Units for Sale" /></td>
                        <td><label for="townhouses">Townhouses</label></td>
                      </tr>
                      <tr>
                        <td><input id="houses" type="checkbox" onClick="Do_AJAX_Search();" /></td>
                        <td align="center"><img src="structure-images/small-house.gif" alt="Houses and Single-Residence Homes for Sale" /></td>
                        <td><label for="houses">Houses</label></td>
                      </tr>
                    </table>
                  </div>
                </div>
              </div>
              
              <table border="0" cellspacing="5" cellpadding="0">
                <tr>
                  <td>
 		            <h3 class="red">Price: <span id="min"></span><span id="max"></span></h3>
			  		<div id="Price-Slider" style="width:150px;height:10px; border:0; margin:10px;"></div>
                  </td>
                  <td width="1" bgcolor="#FFFFFF"><br /></td>
                  <td>
                    <h3 class="red">Bedrooms: <span id="bed"></span>+</h3>
                    <div id="Bed-Slider" style="width:100px;height:10px; border:0; margin:10px;"></div>
                  </td>
                  <td width="1" bgcolor="#FFFFFF"><br /></td>
                  <td>
                    <h3 class="red">Bathrooms: <span id="bath"></span>+</h3>
                    <div id="Bath-Slider" style="width:100px;height:10px; border:0; margin:10px;"></div>
                  </td>
                  <td width="1" bgcolor="#FFFFFF"><br /></td>
                  <td>
                    <h3 class="red"><span id="sqft"></span>+ sq. ft.</h3>
                    <div id="SQFT-Slider" style="width:100px;height:10px; border:0; margin:10px;"></div>
                  </td>
                </tr>
              </table>
              <br />
            </td>
          </tr>
          <tr>
            <td class="footer"><img src="structure-images/text-holder-bottom.png" alt="Victoria Real Estate Information footer" /></td>
          </tr>
        </table>
      </td>
      <td width="50%"></td>
    </tr>
  </table>
</div>

<div id="map_canvas" style="width:100%; height:100%; border:0; margin-top:-10px; margin-left:-10px; margin-bottom:10px;"></div>

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-21634849-1']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();

</script>

</body>
</html>

For one, I wonder why you build your own JSON result. PHP comes with a nice json_encode function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.