Link to home
Start Free TrialLog in
Avatar of dino_angelides
dino_angelides

asked on

Php Real Estate Script

Ok in this scenario is the map search.....this question might have a couple of parts to it but lets do each question one part!
The scenario goes like this.....the user clicks on the index page the link that says search on the map and they are taken to the page.....the link on the index page takes them directly to the region that is the capital of the country.
Once inside the there is a link to select region so change the results based on region. Again like the previous ones there are the update criteria....Listing Type, Property Type, Bedrooms, Bathrooms, Min Price and Max Price
I have included the code below.....there is a recordset i created with dreamweaver feel free to change that
The results appear on the left of the page, the region select on top of the results and the update criteria on the center of the page....Also there is an iframe of a map there, dont page attention to it just yet, on the other question we will see how to do it! but leave it on the code!!!
<div id="mainContent">
    <div id="header1"><img src="/RealEstateOnline/images/mapBanner2.jpg" width="983" height="58" /></div>
  <div id="centerContent"><span class="style8">Browse for a property by selecting the area of your choice. Our map will give you an overview of whats available in the selected areas.<br />
        <strong><strong><strong></strong></strong><br />
      Additional Criteria (optional)</strong><br />
    </span>
      <form id="addCriteriaSearchForm" name="addCriteriaSearchForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
        <table width="100%" border="0">
          <tr>
            <td width="16%" class="style8">Property Type</td>
            <td width="15%" class="style8">Listing Type</td>
            
            <td width="13%"><span class="style8">Bedrooms</span></td>
            <td width="13%"><span class="style8">Baths</span></td>
            <td width="17%" class="style8">Minimum Price (&#8364;):</td>
            <td width="16%"><span class="style8">Maximum Price<span class="style81"> (&#8364;)</span>:</span></td>
            <td width="10%">&nbsp;</td>
          </tr>
          <tr>
            <td class="style8"><span class="style811">
              <select name="propType" class="style22" id="propType">
                <option value="">Property Type</option>
                <option value="'Flat','House','Shop','Office','Plot','Land','Warehouse'" <?php echo ($propType=="'Flat','House','Shop','Office','Plot','Land','Warehouse'" ? 'selected' : ''); ?>>Any</option>
                <option value="'Flat'" <?php echo ($propType=="'Flat'" ? 'selected' : ''); ?>>Flat</option>
                <option value="'House'" <?php echo ($propType=="'House'" ? 'selected' : ''); ?>>House</option>
                <option value="'Shop'" <?php echo ($propType=="'Shop'" ? 'selected' : ''); ?>>Shop</option>
                <option value="'Office'" <?php echo ($propType=="'Office'" ? 'selected' : ''); ?>>Office</option>
                <option value="'Plot'" <?php echo ($propType=="'Plot'" ? 'selected' : ''); ?>>Plot</option>
                <option value="'Land'" <?php echo ($propType=="'Land'" ? 'selected' : ''); ?>>Land</option>
                <option value="'Warehouse'" <?php echo ($propType=="'Warehouse'" ? 'selected' : ''); ?>>Warehouse</option>
              </select>
            </span></td>
            <td class="style8"><span class="style811">
              <select name="listingType" class="style22" id="listingType">
                <option>Listing Type</option>
                <option value="'For Rent','For Sale'" <?php echo ($listingType=="'For Rent','For Sale'" ? 'selected' : ''); ?>>Any</option>
                <option value="'For Rent'" <?php echo ($listingType=="'For Rent'" ? 'selected' : ''); ?>>For Rent</option>
                <option value="'For Sale'" <?php echo ($listingType=="'For Sale'" ? 'selected' : ''); ?>>For Sale</option>
              </select>
            </span></td>
            <td><select name="beds" class="style22" id="beds">
  <option value="any" <?php echo ($beds=="any" ? 'selected' : ''); ?>>Any</option>
              <option value="1" <?php echo ($beds=="1" ? 'selected' : ''); ?>>1</option>
              <option value="2" <?php echo ($beds=="2" ? 'selected' : ''); ?>>2</option>
              <option value="3" <?php echo ($beds=="3" ? 'selected' : ''); ?>>3</option>
              <option value="4" <?php echo ($beds=="4" ? 'selected' : ''); ?>>4</option>
              <option value="5plus" <?php echo ($beds=="5plus" ? 'selected' : ''); ?>>5+</option>
            </select></td>
            <td><select name="baths" class="style22" id="baths">
<option value="any" <?php echo ($baths=="any" ? 'selected' : ''); ?>>Any</option>
              <option value="1" <?php echo ($baths=="1" ? 'selected' : ''); ?>>1</option>
              <option value="2" <?php echo ($baths=="2" ? 'selected' : ''); ?>>2</option>
              <option value="3" <?php echo ($baths=="3" ? 'selected' : ''); ?>>3</option>
              <option value="4" <?php echo ($baths=="4" ? 'selected' : ''); ?>>4</option>
              <option value="5plus" <?php echo ($baths=="5plus" ? 'selected' : ''); ?>>5+</option>
            </select></td>
            <td><select name="minPrice" class="style22" id="minPrice">
<option value="0" selected="selected" <?php echo ($minPrice=="0" ? 'selected' : ''); ?>>Any</option>
              <option value="10000" <?php echo ($minPrice=="10000" ? 'selected' : ''); ?>>10,000</option>
              <option value="20000" <?php echo ($minPrice=="20000" ? 'selected' : ''); ?>>20,000</option>
              <option value="30000" <?php echo ($minPrice=="30000" ? 'selected' : ''); ?>>30,000</option>
              <option value="40000" <?php echo ($minPrice=="40000" ? 'selected' : ''); ?>>40,000</option>
              <option value="50000" <?php echo ($minPrice=="50000" ? 'selected' : ''); ?>>50,000</option>
              <option value="60000" <?php echo ($minPrice=="60000" ? 'selected' : ''); ?>>60,000</option>
              <option value="70000" <?php echo ($minPrice=="70000" ? 'selected' : ''); ?>>70,000</option>
              <option value="80000" <?php echo ($minPrice=="80000" ? 'selected' : ''); ?>>80,000</option>
              <option value="90000" <?php echo ($minPrice=="90000" ? 'selected' : ''); ?>>90,000</option>
              <option value="100000" <?php echo ($minPrice=="100000" ? 'selected' : ''); ?>>100,000</option>
              <option value="110000" <?php echo ($minPrice=="110000" ? 'selected' : ''); ?>>110,000</option>
              <option value="120000" <?php echo ($minPrice=="120000" ? 'selected' : ''); ?>>120,000</option>
              <option value="130000" <?php echo ($minPrice=="130000" ? 'selected' : ''); ?>>130,000</option>
              <option value="140000" <?php echo ($minPrice=="140000" ? 'selected' : ''); ?>>140,000</option>
              <option value="150000" <?php echo ($minPrice=="150000" ? 'selected' : ''); ?>>150,000</option>
              <option value="160000" <?php echo ($minPrice=="160000" ? 'selected' : ''); ?>>160,000</option>
              <option value="170000" <?php echo ($minPrice=="170000" ? 'selected' : ''); ?>>170,000</option>
              <option value="180000" <?php echo ($minPrice=="180000" ? 'selected' : ''); ?>>180,000</option>
              <option value="190000" <?php echo ($minPrice=="190000" ? 'selected' : ''); ?>>190,000</option>
              <option value="200000" <?php echo ($minPrice=="200000" ? 'selected' : ''); ?>>200,000</option>
              <option value="220000" <?php echo ($minPrice=="220000" ? 'selected' : ''); ?>>220,000</option>
              <option value="240000" <?php echo ($minPrice=="240000" ? 'selected' : ''); ?>>240,000</option>
              <option value="260000" <?php echo ($minPrice=="260000" ? 'selected' : ''); ?>>260,000</option>
              <option value="280000" <?php echo ($minPrice=="280000" ? 'selected' : ''); ?>>280,000</option>
              <option value="300000" <?php echo ($minPrice=="300000" ? 'selected' : ''); ?>>300,000</option>
              <option value="320000" <?php echo ($minPrice=="320000" ? 'selected' : ''); ?>>320,000</option>
              <option value="340000" <?php echo ($minPrice=="34000" ? 'selected' : ''); ?>>340,000</option>
              <option value="360000" <?php echo ($minPrice=="360000" ? 'selected' : ''); ?>>360,000</option>
              <option value="380000" <?php echo ($minPrice=="380000" ? 'selected' : ''); ?>>380,000</option>
              <option value="400000" <?php echo ($minPrice=="400000" ? 'selected' : ''); ?>>400,000</option>
              <option value="420000" <?php echo ($minPrice=="420000" ? 'selected' : ''); ?>>420,000</option>
              <option value="440000" <?php echo ($minPrice=="440000" ? 'selected' : ''); ?>>440,000</option>
              <option value="460000" <?php echo ($minPrice=="460000" ? 'selected' : ''); ?>>460,000</option>
              <option value="480000" <?php echo ($minPrice=="480000" ? 'selected' : ''); ?>>480,000</option>
              <option value="500000" <?php echo ($minPrice=="500000" ? 'selected' : ''); ?>>500,000</option>
              <option value="550000" <?php echo ($minPrice=="550000" ? 'selected' : ''); ?>>550,000</option>
              <option value="600000" <?php echo ($minPrice=="600000" ? 'selected' : ''); ?>>600,000</option>
              <option value="650000" <?php echo ($minPrice=="650000" ? 'selected' : ''); ?>>650,000</option>
              <option value="700000" <?php echo ($minPrice=="700000" ? 'selected' : ''); ?>>700,000</option>
              <option value="750000" <?php echo ($minPrice=="750000" ? 'selected' : ''); ?>>750,000</option>
              <option value="800000" <?php echo ($minPrice=="800000" ? 'selected' : ''); ?>>800,000</option>
              <option value="900000" <?php echo ($minPrice=="900000" ? 'selected' : ''); ?>>900,000</option>
              <option value="1000000" <?php echo ($minPrice=="1000000" ? 'selected' : ''); ?>>1,000,000</option>
              <option value="1500000" <?php echo ($minPrice=="1500000" ? 'selected' : ''); ?>>1,500,000</option>
              <option value="2000000" <?php echo ($minPrice=="2000000" ? 'selected' : ''); ?>>2,000,000</option>
            </select></td>
            <td><select name="maxPrice" class="style22" id="maxPrice">
<option value="9999999" selected="selected" <?php echo ($maxPrice=="9999999" ? 'selected' : ''); ?>>Any</option>
              <option value="10000" <?php echo ($maxPrice=="10000" ? 'selected' : ''); ?>>10,000</option>
              <option value="20000" <?php echo ($maxPrice=="20000" ? 'selected' : ''); ?>>20,000</option>
              <option value="30000" <?php echo ($maxPrice=="30000" ? 'selected' : ''); ?>>30,000</option>
              <option value="40000" <?php echo ($maxPrice=="40000" ? 'selected' : ''); ?>>40,000</option>
              <option value="50000" <?php echo ($maxPrice=="50000" ? 'selected' : ''); ?>>50,000</option>
              <option value="60000" <?php echo ($maxPrice=="60000" ? 'selected' : ''); ?>>60,000</option>
              <option value="70000" <?php echo ($maxPrice=="70000" ? 'selected' : ''); ?>>70,000</option>
              <option value="80000" <?php echo ($maxPrice=="80000" ? 'selected' : ''); ?>>80,000</option>
              <option value="90000" <?php echo ($maxPrice=="90000" ? 'selected' : ''); ?>>90,000</option>
              <option value="100000" <?php echo ($maxPrice=="100000" ? 'selected' : ''); ?>>100,000</option>
              <option value="110000" <?php echo ($maxPrice=="110000" ? 'selected' : ''); ?>>110,000</option>
              <option value="120000" <?php echo ($maxPrice=="120000" ? 'selected' : ''); ?>>120,000</option>
              <option value="130000" <?php echo ($maxPrice=="130000" ? 'selected' : ''); ?>>130,000</option>
              <option value="140000" <?php echo ($maxPrice=="140000" ? 'selected' : ''); ?>>140,000</option>
              <option value="150000" <?php echo ($maxPrice=="150000" ? 'selected' : ''); ?>>150,000</option>
              <option value="160000" <?php echo ($maxPrice=="160000" ? 'selected' : ''); ?>>160,000</option>
              <option value="170000" <?php echo ($maxPrice=="170000" ? 'selected' : ''); ?>>170,000</option>
              <option value="180000" <?php echo ($maxPrice=="180000" ? 'selected' : ''); ?>>180,000</option>
              <option value="190000" <?php echo ($maxPrice=="190000" ? 'selected' : ''); ?>>190,000</option>
              <option value="200000" <?php echo ($maxPrice=="200000" ? 'selected' : ''); ?>>200,000</option>
              <option value="220000" <?php echo ($maxPrice=="220000" ? 'selected' : ''); ?>>220,000</option>
              <option value="240000" <?php echo ($maxPrice=="240000" ? 'selected' : ''); ?>>240,000</option>
              <option value="260000" <?php echo ($maxPrice=="260000" ? 'selected' : ''); ?>>260,000</option>
              <option value="280000" <?php echo ($maxPrice=="280000" ? 'selected' : ''); ?>>280,000</option>
              <option value="300000" <?php echo ($maxPrice=="300000" ? 'selected' : ''); ?>>300,000</option>
              <option value="320000" <?php echo ($maxPrice=="320000" ? 'selected' : ''); ?>>320,000</option>
              <option value="340000" <?php echo ($maxPrice=="34000" ? 'selected' : ''); ?>>340,000</option>
              <option value="360000" <?php echo ($maxPrice=="360000" ? 'selected' : ''); ?>>360,000</option>
              <option value="380000" <?php echo ($maxPrice=="380000" ? 'selected' : ''); ?>>380,000</option>
              <option value="400000" <?php echo ($maxPrice=="400000" ? 'selected' : ''); ?>>400,000</option>
              <option value="420000" <?php echo ($maxPrice=="420000" ? 'selected' : ''); ?>>420,000</option>
              <option value="440000" <?php echo ($maxPrice=="440000" ? 'selected' : ''); ?>>440,000</option>
              <option value="460000" <?php echo ($maxPrice=="460000" ? 'selected' : ''); ?>>460,000</option>
              <option value="480000" <?php echo ($maxPrice=="480000" ? 'selected' : ''); ?>>480,000</option>
              <option value="500000" <?php echo ($maxPrice=="500000" ? 'selected' : ''); ?>>500,000</option>
              <option value="550000" <?php echo ($maxPrice=="550000" ? 'selected' : ''); ?>>550,000</option>
              <option value="600000" <?php echo ($maxPrice=="600000" ? 'selected' : ''); ?>>600,000</option>
              <option value="650000" <?php echo ($maxPrice=="650000" ? 'selected' : ''); ?>>650,000</option>
              <option value="700000" <?php echo ($maxPrice=="700000" ? 'selected' : ''); ?>>700,000</option>
              <option value="750000" <?php echo ($maxPrice=="750000" ? 'selected' : ''); ?>>750,000</option>
              <option value="800000" <?php echo ($maxPrice=="800000" ? 'selected' : ''); ?>>800,000</option>
              <option value="900000" <?php echo ($maxPrice=="900000" ? 'selected' : ''); ?>>900,000</option>
              <option value="1000000" <?php echo ($maxPrice=="1000000" ? 'selected' : ''); ?>>1,000,000</option>
              <option value="1500000" <?php echo ($maxPrice=="1500000" ? 'selected' : ''); ?>>1,500,000</option>
              <option value="2000000" <?php echo ($maxPrice=="2000000" ? 'selected' : ''); ?>>2,000,000</option>
            </select></td>
            <td><span class="style21">
              <input type="submit" name="button2" id="button2" value="Search" />
            </span></td>
          </tr>
        </table>

<!-- WebCruiser start -->        
<script type="text/javascript">
	// Send a message to the map via the map proxy frame, toggling the proxy's
    // size to indicate there is a message ready to be read
    function sendMessageToFrame(message) {
        var elem = top.document.getElementById('mapFrameProxy');
        elem.contentWindow.location = 'http://www.col.com.cy:8190/webcruiserpanel/InnerFrameProxy.html#' + message + '&frame=mapFrame';
        elem.width = elem.width > 50 ? 50 : 100;
    }
    
    function showArea(areas) {
    	var area = (areas.options[areas.selectedIndex].value);
    	// alert('Show area ' + area);
    	sendMessageToFrame(area);
    }
</script>
<!-- WebCruiser end -->   





     
<!-- WebCruiser The name/id of the map's iframe must "mapFrame". The CoL link is http://www.col.com.cy:8190/webcruiserpanel/template-no-border.html?channel=gr.talent.channel.cyprus&locale=en&split-pos=100% -->       
        <iframe name="mapFrame" id="mapFrame" frameborder="0" style="position:absolute; left:983; top:500; background:transparent; width: 798px; height: 708px;"
      src="http://www.col.com.cy:8190/webcruiserpanel/template-no-border.html?channel=gr.talent.channel.cyprus&locale=en&split-pos=100%" width="983" height="500"> </iframe>
        <br />

<!-- WebCruiser start -->        
	  <iframe name="mapFrameProxy" id="mapFrameProxy" width="10px" height="10px" frameborder="1" src="http://www.col.com.cy:8190/webcruiserpanel/InnerFrameProxy.html" style=" position: absolute; left: -150px; top: -150px;"></iframe>
<!-- WebCruiser end -->        

      </form>
      <span class="style8"><br />
    </span></div>
    <div class="style81" id="leftContent">
      <br />
      <label>
        <select name="select6" class="style2" id="select6">
          <option>Select Map Language</option>
          <option>English Version</option>
          <option>Greek Version</option>
        </select>
      </label>
      <br />
      <br />
      <form id="form3" name="form2" method="post" action="">
        <table width="95%" border="0">
          <tr>
            <td width="37%" class="style2">Select Area:</td>
            <td width="63%"><span class="style8">
<!-- WebCruiser start -->            
              <select name="select" class="style2" id="select"  onChange="showArea(this)")" >
                <option value="mapsearch.php?region=Nicosia&channel=gr.talent.channel.cyprus&amp;ulx=525936&amp;uly=3885248&amp;w=14688&amp;h=8960" selected="selected">Nicosia</option>
                <option value="mapsearch.php?region=Larnaca&channel=gr.talent.channel.cyprus&amp;ulx=549744&amp;uly=3859640&amp;w=14688&amp;h=8960">Larnaca</option>
                <option value="mapsearch.php?region=Limassol&channel=gr.talent.channel.cyprus&ulx=497440&uly=3833144&w=14688&h=8960">Limassol</option>
                <option value="mapsearch.php?region=Paphos&channel=gr.talent.channel.cyprus&ulx=440224&uly=3843544&w=14688&h=8960">Paphos</option>
                <option value="mapsearch.php?region=Ayia Napa&channel=gr.talent.channel.cyprus&ulx=589811.9510425703&uly=3871441.5857088603&w=2334&h=1508">Ayia Napa</option>
<!-- WebCruiser end -->            
              </select>
            </span></td>
          </tr>
        </table>
        <table width="95%" border="0">
          <tr>
            <td width="24%"><span class="style8">Sort by:</span></td>
            <td width="76%"><select name="select2" class="style21" id="select2">
              <option value="1">Price High-Low</option>
              <option value="2">Price Low-High</option>
            </select></td>
          </tr>
        </table>
        <table width="98%" border="0">
          <tr>
            <td width="63%"><span class="style21"><?php echo ($startRow_rsLisRe + 1) ?>-<?php echo min($startRow_rsLisRe + $maxRows_rsLisRe, $totalRows_rsLisRe) ?> / <span class="style22"><?php echo $totalRows_rsLisRe ?></span> records</span></td>
            <td width="24%" class="style21"><a href="<?php printf("%s?pageNum_rsLisRe=%d%s", $currentPage, max(0, $pageNum_rsLisRe - 1), $queryString_rsLisRe); ?>" class="style211">previous</a></td>
            <td width="13%" class="style21"><a href="<?php printf("%s?pageNum_rsLisRe=%d%s", $currentPage, min($totalPages_rsLisRe, $pageNum_rsLisRe + 1), $queryString_rsLisRe); ?>" class="style211">next</a></td>
          </tr>
        </table>
        <table width="95%" border="0">
          <tr>
            <td height="162"><div id="searchResultsForMap">
              <table width="100%" border="0">
                <tr>
                  <td height="24" colspan="2" class="style21"><strong><?php echo $row_rsLisRe['listingType']; ?></strong> Property,<span class="style211"> <?php echo $row_rsLisRe['region']; ?></span></td>
                </tr>
                <tr>
                  <td width="54%" rowspan="3"><div align="center"><?php echo '<img src=" images/' . $row_rsLisRe['image1'] . '" />' . PHP_EOL;
 ?></div></td>
                  <td width="46%"><span class="style21">&euro;<span class="style211"><?php echo $row_rsLisRe['price']; ?></span></span></td>
                </tr>
                <tr>
                  <td class="style21"><span class="style211"><?php echo $row_rsLisRe['beds']; ?></span> beds | <span class="style211"><?php echo $row_rsLisRe['baths']; ?></span> baths</td>
                </tr>
                <tr>
                  <td class="style21"><span class="style211"><?php echo $row_rsLisRe['coveredArea']; ?></span> area</td>
                </tr>
                <tr>
                  <!-- WebCruiser start -->
                  <td height="16"><a href="" class="style21" onclick="sendMessageToFrame('<?php echo $row_rsLisRe['mapLocation']; ?>');return false;")">Locate</a> <span class="style21"><a href="" class="style21">Save</a><a href="#"></a></span></td>
                  <td><a href="" class="style21" onclick="sendMessageToFrame('channel=gr.talent.channel.cyprus&amp;split-pos=65%');return false;")">Search Nearby</a></td>
                  <!-- WebCruiser end -->
                </tr>
                <tr>
                  <td height="16" colspan="2" class="style21"><a href="/RealEstateOnline/bubbleSample1.php?id=<?php echo $row_rsLisRe['id']; ?>" target="_blank" class="style21">View Details Sample Link</a></td>
                </tr>
              </table>
            </div></td>
        </table>
      </form>
    </div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
<br />
<p><br />
    </p>
    <p>&nbsp;</p>
  </div>

Open in new window

Avatar of john-formby
john-formby
Flag of Ghana image

Sorry, had to go out for a little while.  Ok, just need to clarify a couple of things :-)

On your index.php page you one link to a map page.  When you click this link it loads the page called? (code above).  This page loads the map for the region of the capital (I guess Nicosia?)

What else do you want to display on this page?
Avatar of dino_angelides
dino_angelides

ASKER

Yes thats correct the capital is called by default.....when the mapsearch opens it displays all the properties for nicosia.....5 per page.
Now there is an option that users can change region....and also there is additional criterial that can filter their results....and like I mentioned above they are the Listing Type, Property Type, Bedrooms, Bathrooms, Min Price and Max Price
Those updates are based on the region selected. So if Nicosia is chosen the updates should be only for nicosia. If another region is selected then it should be for that other region...
I hope I am clearer now :)
Yes, that is clearer.  You are missing a lot from that page.  You have no queries or pagination code.

Let me have a look and I will post what I come up with.
yea i had queries i made with dreamweaver and it was functional (at least the region change was giving me the correct data) but i guessed since we need to do the updates as well, i removed them !!!
ASKER CERTIFIED SOLUTION
Avatar of john-formby
john-formby
Flag of Ghana image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
again very weird i am getting an error for Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in........ and i have the database info....posting you the code so you double check!!
the info on the connectivity i changed since this is public....
<?php
$dbHost = "host";
$dbUser = "username";
$dbPass = "password";
$dbName = "db";
$db = mysql_connect($dbHost,$dbUser,$dbPass);
mysql_select_db($dbName,$db);

foreach($_REQUEST as $key=>$value) {  
    $$key = $value;  
}

$pall = $_REQUEST['p'];
$sort = $_REQUEST['sort'];
if(!isset($_REQUEST['sort'])) {
	$sort = '1';
}

$baths1 = $_REQUEST['baths'];
$beds1 = $_REQUEST['beds'];

if(empty($_REQUEST['beds']) || $_REQUEST['beds'] == 'any') {
	$beds = 'any';
	$beds1 = '1,2,3,4,5,6,7,8,9,10';
} elseif($_REQUEST['beds'] == '5plus') {
	$beds1 = '5,6,7,8,9,10';
}

if(empty($_REQUEST['baths']) || $_REQUEST['baths'] == 'any') {
	$baths = 'any';
	$baths1 = '1,2,3,4,5,6,7,8,9,10';
} elseif($_REQUEST['baths'] == '5plus') {
	$baths1 = '5,6,7,8,9,10';
}
if(empty($_REQUEST['minPrice'])) {
	$minPrice = '0';
}
if(empty($_REQUEST['maxPrice'])) {
	$maxPrice = '9999999';
}
if(empty($_REQUEST['listingType'])) {
	$listingType = "'For Rent','For Sale'";
}
if(empty($_REQUEST['propType'])) {
	$propType = "'Flat','House','Shop','Office','Plot','Land','Warehouse'";
}
if(empty($_REQUEST['region'])) {
	$region = "'Nicosia'";
}

$total_pages = $_REQUEST['p']; 
$per_page = 5; 
$cur_page = isset($_REQUEST['p']) ? (int)$_REQUEST['p'] : 1; 
if($sort == '2') { 
    $query = "SELECT * FROM listings WHERE region = $region AND price BETWEEN $minPrice AND $maxPrice AND listingType IN($listingType)  AND propType IN($propType) AND beds IN($beds1) AND baths IN($baths1) ORDER BY price ASC";
} elseif($sort == '1') { 
    $query = "SELECT * FROM listings WHERE region = $region AND price BETWEEN $minPrice AND $maxPrice AND listingType IN($listingType) AND propType IN($propType) AND beds IN($beds1) AND baths IN($baths1) ORDER BY price DESC"; 
} 
$result = @mysql_query($query); 
$numrows = mysql_num_rows($result); 
$total_pages = ceil($numrows / $per_page); 
if ($cur_page <1 || $cur_page> $total_pages) { 
        $cur_page = 1; 
} 
$offset = (($cur_page - 1) * $per_page); 
if($sort == '2') { 
    $query = "SELECT * FROM listings WHERE region = $region AND price BETWEEN $minPrice AND $maxPrice AND listingType IN($listingType) AND propType IN($propType) AND beds IN($beds1) AND baths IN($baths1) ORDER BY price ASC LIMIT $offset, $per_page"; 
} elseif($sort == '1') { 
    $query = "SELECT * FROM listings WHERE region = $region AND price BETWEEN $minPrice AND $maxPrice AND listingType IN($listingType) AND propType IN($propType) AND beds IN($beds1) AND baths IN($baths1) ORDER BY price DESC LIMIT $offset, $per_page"; 
} 
$result = @mysql_query($query); 
$total = mysql_num_rows($result); 
$counter = 1 + (($cur_page-1)*$per_page); 
 
if($numrows <= 0) {   
    echo 'No Results';   
} else {   
    while($row_rsLisRe = mysql_fetch_array($result)) { 
         
?> 

<div id="mainContent">
    <div id="header1"><img src="/RealEstateOnline/images/mapBanner2.jpg" width="983" height="58" /></div>
  <div id="centerContent"><span class="style8">Browse for a property by selecting the area of your choice. Our map will give you an overview of whats available in the selected areas.<br />
        <strong><strong><strong></strong></strong><br />
      Additional Criteria (optional)</strong><br />
    </span>
      <form id="addCriteriaSearchForm" name="addCriteriaSearchForm" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
      <input type="hidden" name="sort" value="<?php echo $sort; ?>" />
      <input type="hidden" name="region" value="<?php echo $region; ?>" />
        <table width="100%" border="0">
          <tr>
            <td width="16%" class="style8">Property Type</td>
            <td width="15%" class="style8">Listing Type</td>
            
            <td width="13%"><span class="style8">Bedrooms</span></td>
            <td width="13%"><span class="style8">Baths</span></td>
            <td width="17%" class="style8">Minimum Price (&#8364;):</td>
            <td width="16%"><span class="style8">Maximum Price<span class="style81"> (&#8364;)</span>:</span></td>
            <td width="10%">&nbsp;</td>
          </tr>
          <tr>
            <td class="style8"><span class="style811">
              <select name="propType" class="style22" id="propType">
                <option value="">Property Type</option>
                <option value="'Flat','House','Shop','Office','Plot','Land','Warehouse'" <?php echo ($propType=="'Flat','House','Shop','Office','Plot','Land','Warehouse'" ? 'selected' : ''); ?>>Any</option>
                <option value="'Flat'" <?php echo ($propType=="'Flat'" ? 'selected' : ''); ?>>Flat</option>
                <option value="'House'" <?php echo ($propType=="'House'" ? 'selected' : ''); ?>>House</option>
                <option value="'Shop'" <?php echo ($propType=="'Shop'" ? 'selected' : ''); ?>>Shop</option>
                <option value="'Office'" <?php echo ($propType=="'Office'" ? 'selected' : ''); ?>>Office</option>
                <option value="'Plot'" <?php echo ($propType=="'Plot'" ? 'selected' : ''); ?>>Plot</option>
                <option value="'Land'" <?php echo ($propType=="'Land'" ? 'selected' : ''); ?>>Land</option>
                <option value="'Warehouse'" <?php echo ($propType=="'Warehouse'" ? 'selected' : ''); ?>>Warehouse</option>
              </select>
            </span></td>
            <td class="style8"><span class="style811">
              <select name="listingType" class="style22" id="listingType">
                <option>Listing Type</option>
                <option value="'For Rent','For Sale'" <?php echo ($listingType=="'For Rent','For Sale'" ? 'selected' : ''); ?>>Any</option>
                <option value="'For Rent'" <?php echo ($listingType=="'For Rent'" ? 'selected' : ''); ?>>For Rent</option>
                <option value="'For Sale'" <?php echo ($listingType=="'For Sale'" ? 'selected' : ''); ?>>For Sale</option>
              </select>
            </span></td>
            <td><select name="beds" class="style22" id="beds">
  <option value="any" <?php echo ($beds=="any" ? 'selected' : ''); ?>>Any</option>
              <option value="1" <?php echo ($beds=="1" ? 'selected' : ''); ?>>1</option>
              <option value="2" <?php echo ($beds=="2" ? 'selected' : ''); ?>>2</option>
              <option value="3" <?php echo ($beds=="3" ? 'selected' : ''); ?>>3</option>
              <option value="4" <?php echo ($beds=="4" ? 'selected' : ''); ?>>4</option>
              <option value="5plus" <?php echo ($beds=="5plus" ? 'selected' : ''); ?>>5+</option>
            </select></td>
            <td><select name="baths" class="style22" id="baths">
<option value="any" <?php echo ($baths=="any" ? 'selected' : ''); ?>>Any</option>
              <option value="1" <?php echo ($baths=="1" ? 'selected' : ''); ?>>1</option>
              <option value="2" <?php echo ($baths=="2" ? 'selected' : ''); ?>>2</option>
              <option value="3" <?php echo ($baths=="3" ? 'selected' : ''); ?>>3</option>
              <option value="4" <?php echo ($baths=="4" ? 'selected' : ''); ?>>4</option>
              <option value="5plus" <?php echo ($baths=="5plus" ? 'selected' : ''); ?>>5+</option>
            </select></td>
            <td><select name="minPrice" class="style22" id="minPrice">
<option value="0" selected="selected" <?php echo ($minPrice=="0" ? 'selected' : ''); ?>>Any</option>
              <option value="10000" <?php echo ($minPrice=="10000" ? 'selected' : ''); ?>>10,000</option>
              <option value="20000" <?php echo ($minPrice=="20000" ? 'selected' : ''); ?>>20,000</option>
              <option value="30000" <?php echo ($minPrice=="30000" ? 'selected' : ''); ?>>30,000</option>
              <option value="40000" <?php echo ($minPrice=="40000" ? 'selected' : ''); ?>>40,000</option>
              <option value="50000" <?php echo ($minPrice=="50000" ? 'selected' : ''); ?>>50,000</option>
              <option value="60000" <?php echo ($minPrice=="60000" ? 'selected' : ''); ?>>60,000</option>
              <option value="70000" <?php echo ($minPrice=="70000" ? 'selected' : ''); ?>>70,000</option>
              <option value="80000" <?php echo ($minPrice=="80000" ? 'selected' : ''); ?>>80,000</option>
              <option value="90000" <?php echo ($minPrice=="90000" ? 'selected' : ''); ?>>90,000</option>
              <option value="100000" <?php echo ($minPrice=="100000" ? 'selected' : ''); ?>>100,000</option>
              <option value="110000" <?php echo ($minPrice=="110000" ? 'selected' : ''); ?>>110,000</option>
              <option value="120000" <?php echo ($minPrice=="120000" ? 'selected' : ''); ?>>120,000</option>
              <option value="130000" <?php echo ($minPrice=="130000" ? 'selected' : ''); ?>>130,000</option>
              <option value="140000" <?php echo ($minPrice=="140000" ? 'selected' : ''); ?>>140,000</option>
              <option value="150000" <?php echo ($minPrice=="150000" ? 'selected' : ''); ?>>150,000</option>
              <option value="160000" <?php echo ($minPrice=="160000" ? 'selected' : ''); ?>>160,000</option>
              <option value="170000" <?php echo ($minPrice=="170000" ? 'selected' : ''); ?>>170,000</option>
              <option value="180000" <?php echo ($minPrice=="180000" ? 'selected' : ''); ?>>180,000</option>
              <option value="190000" <?php echo ($minPrice=="190000" ? 'selected' : ''); ?>>190,000</option>
              <option value="200000" <?php echo ($minPrice=="200000" ? 'selected' : ''); ?>>200,000</option>
              <option value="220000" <?php echo ($minPrice=="220000" ? 'selected' : ''); ?>>220,000</option>
              <option value="240000" <?php echo ($minPrice=="240000" ? 'selected' : ''); ?>>240,000</option>
              <option value="260000" <?php echo ($minPrice=="260000" ? 'selected' : ''); ?>>260,000</option>
              <option value="280000" <?php echo ($minPrice=="280000" ? 'selected' : ''); ?>>280,000</option>
              <option value="300000" <?php echo ($minPrice=="300000" ? 'selected' : ''); ?>>300,000</option>
              <option value="320000" <?php echo ($minPrice=="320000" ? 'selected' : ''); ?>>320,000</option>
              <option value="340000" <?php echo ($minPrice=="34000" ? 'selected' : ''); ?>>340,000</option>
              <option value="360000" <?php echo ($minPrice=="360000" ? 'selected' : ''); ?>>360,000</option>
              <option value="380000" <?php echo ($minPrice=="380000" ? 'selected' : ''); ?>>380,000</option>
              <option value="400000" <?php echo ($minPrice=="400000" ? 'selected' : ''); ?>>400,000</option>
              <option value="420000" <?php echo ($minPrice=="420000" ? 'selected' : ''); ?>>420,000</option>
              <option value="440000" <?php echo ($minPrice=="440000" ? 'selected' : ''); ?>>440,000</option>
              <option value="460000" <?php echo ($minPrice=="460000" ? 'selected' : ''); ?>>460,000</option>
              <option value="480000" <?php echo ($minPrice=="480000" ? 'selected' : ''); ?>>480,000</option>
              <option value="500000" <?php echo ($minPrice=="500000" ? 'selected' : ''); ?>>500,000</option>
              <option value="550000" <?php echo ($minPrice=="550000" ? 'selected' : ''); ?>>550,000</option>
              <option value="600000" <?php echo ($minPrice=="600000" ? 'selected' : ''); ?>>600,000</option>
              <option value="650000" <?php echo ($minPrice=="650000" ? 'selected' : ''); ?>>650,000</option>
              <option value="700000" <?php echo ($minPrice=="700000" ? 'selected' : ''); ?>>700,000</option>
              <option value="750000" <?php echo ($minPrice=="750000" ? 'selected' : ''); ?>>750,000</option>
              <option value="800000" <?php echo ($minPrice=="800000" ? 'selected' : ''); ?>>800,000</option>
              <option value="900000" <?php echo ($minPrice=="900000" ? 'selected' : ''); ?>>900,000</option>
              <option value="1000000" <?php echo ($minPrice=="1000000" ? 'selected' : ''); ?>>1,000,000</option>
              <option value="1500000" <?php echo ($minPrice=="1500000" ? 'selected' : ''); ?>>1,500,000</option>
              <option value="2000000" <?php echo ($minPrice=="2000000" ? 'selected' : ''); ?>>2,000,000</option>
            </select></td>
            <td><select name="maxPrice" class="style22" id="maxPrice">
<option value="9999999" selected="selected" <?php echo ($maxPrice=="9999999" ? 'selected' : ''); ?>>Any</option>
              <option value="10000" <?php echo ($maxPrice=="10000" ? 'selected' : ''); ?>>10,000</option>
              <option value="20000" <?php echo ($maxPrice=="20000" ? 'selected' : ''); ?>>20,000</option>
              <option value="30000" <?php echo ($maxPrice=="30000" ? 'selected' : ''); ?>>30,000</option>
              <option value="40000" <?php echo ($maxPrice=="40000" ? 'selected' : ''); ?>>40,000</option>
              <option value="50000" <?php echo ($maxPrice=="50000" ? 'selected' : ''); ?>>50,000</option>
              <option value="60000" <?php echo ($maxPrice=="60000" ? 'selected' : ''); ?>>60,000</option>
              <option value="70000" <?php echo ($maxPrice=="70000" ? 'selected' : ''); ?>>70,000</option>
              <option value="80000" <?php echo ($maxPrice=="80000" ? 'selected' : ''); ?>>80,000</option>
              <option value="90000" <?php echo ($maxPrice=="90000" ? 'selected' : ''); ?>>90,000</option>
              <option value="100000" <?php echo ($maxPrice=="100000" ? 'selected' : ''); ?>>100,000</option>
              <option value="110000" <?php echo ($maxPrice=="110000" ? 'selected' : ''); ?>>110,000</option>
              <option value="120000" <?php echo ($maxPrice=="120000" ? 'selected' : ''); ?>>120,000</option>
              <option value="130000" <?php echo ($maxPrice=="130000" ? 'selected' : ''); ?>>130,000</option>
              <option value="140000" <?php echo ($maxPrice=="140000" ? 'selected' : ''); ?>>140,000</option>
              <option value="150000" <?php echo ($maxPrice=="150000" ? 'selected' : ''); ?>>150,000</option>
              <option value="160000" <?php echo ($maxPrice=="160000" ? 'selected' : ''); ?>>160,000</option>
              <option value="170000" <?php echo ($maxPrice=="170000" ? 'selected' : ''); ?>>170,000</option>
              <option value="180000" <?php echo ($maxPrice=="180000" ? 'selected' : ''); ?>>180,000</option>
              <option value="190000" <?php echo ($maxPrice=="190000" ? 'selected' : ''); ?>>190,000</option>
              <option value="200000" <?php echo ($maxPrice=="200000" ? 'selected' : ''); ?>>200,000</option>
              <option value="220000" <?php echo ($maxPrice=="220000" ? 'selected' : ''); ?>>220,000</option>
              <option value="240000" <?php echo ($maxPrice=="240000" ? 'selected' : ''); ?>>240,000</option>
              <option value="260000" <?php echo ($maxPrice=="260000" ? 'selected' : ''); ?>>260,000</option>
              <option value="280000" <?php echo ($maxPrice=="280000" ? 'selected' : ''); ?>>280,000</option>
              <option value="300000" <?php echo ($maxPrice=="300000" ? 'selected' : ''); ?>>300,000</option>
              <option value="320000" <?php echo ($maxPrice=="320000" ? 'selected' : ''); ?>>320,000</option>
              <option value="340000" <?php echo ($maxPrice=="34000" ? 'selected' : ''); ?>>340,000</option>
              <option value="360000" <?php echo ($maxPrice=="360000" ? 'selected' : ''); ?>>360,000</option>
              <option value="380000" <?php echo ($maxPrice=="380000" ? 'selected' : ''); ?>>380,000</option>
              <option value="400000" <?php echo ($maxPrice=="400000" ? 'selected' : ''); ?>>400,000</option>
              <option value="420000" <?php echo ($maxPrice=="420000" ? 'selected' : ''); ?>>420,000</option>
              <option value="440000" <?php echo ($maxPrice=="440000" ? 'selected' : ''); ?>>440,000</option>
              <option value="460000" <?php echo ($maxPrice=="460000" ? 'selected' : ''); ?>>460,000</option>
              <option value="480000" <?php echo ($maxPrice=="480000" ? 'selected' : ''); ?>>480,000</option>
              <option value="500000" <?php echo ($maxPrice=="500000" ? 'selected' : ''); ?>>500,000</option>
              <option value="550000" <?php echo ($maxPrice=="550000" ? 'selected' : ''); ?>>550,000</option>
              <option value="600000" <?php echo ($maxPrice=="600000" ? 'selected' : ''); ?>>600,000</option>
              <option value="650000" <?php echo ($maxPrice=="650000" ? 'selected' : ''); ?>>650,000</option>
              <option value="700000" <?php echo ($maxPrice=="700000" ? 'selected' : ''); ?>>700,000</option>
              <option value="750000" <?php echo ($maxPrice=="750000" ? 'selected' : ''); ?>>750,000</option>
              <option value="800000" <?php echo ($maxPrice=="800000" ? 'selected' : ''); ?>>800,000</option>
              <option value="900000" <?php echo ($maxPrice=="900000" ? 'selected' : ''); ?>>900,000</option>
              <option value="1000000" <?php echo ($maxPrice=="1000000" ? 'selected' : ''); ?>>1,000,000</option>
              <option value="1500000" <?php echo ($maxPrice=="1500000" ? 'selected' : ''); ?>>1,500,000</option>
              <option value="2000000" <?php echo ($maxPrice=="2000000" ? 'selected' : ''); ?>>2,000,000</option>
            </select></td>
            <td><span class="style21">
              <input type="submit" name="button2" id="button2" value="Search" />
            </span></td>
          </tr>
        </table>

<!-- WebCruiser start -->        
<script type="text/javascript">
	// Send a message to the map via the map proxy frame, toggling the proxy's
    // size to indicate there is a message ready to be read
    function sendMessageToFrame(message) {
        var elem = top.document.getElementById('mapFrameProxy');
        elem.contentWindow.location = 'http://www.col.com.cy:8190/webcruiserpanel/InnerFrameProxy.html#' + message + '&frame=mapFrame';
        elem.width = elem.width > 50 ? 50 : 100;
    }
    
    function showArea(areas) {
    	var area = (areas.options[areas.selectedIndex].value);
    	// alert('Show area ' + area);
    	sendMessageToFrame(area);
    }
</script>
<!-- WebCruiser end -->   





     
<!-- WebCruiser The name/id of the map's iframe must "mapFrame". The CoL link is http://www.col.com.cy:8190/webcruiserpanel/template-no-border.html?channel=gr.talent.channel.cyprus&locale=en&split-pos=100% -->       
        <iframe name="mapFrame" id="mapFrame" frameborder="0" style="position:absolute; left:983; top:500; background:transparent; width: 798px; height: 708px;"
      src="http://www.col.com.cy:8190/webcruiserpanel/template-no-border.html?channel=gr.talent.channel.cyprus&locale=en&split-pos=100%" width="983" height="500"> </iframe>
        <br />

<!-- WebCruiser start -->        
	  <iframe name="mapFrameProxy" id="mapFrameProxy" width="10px" height="10px" frameborder="1" src="http://www.col.com.cy:8190/webcruiserpanel/InnerFrameProxy.html" style=" position: absolute; left: -150px; top: -150px;"></iframe>
<!-- WebCruiser end -->        

      </form>
      <span class="style8"><br />
    </span></div>
    <div class="style81" id="leftContent">
      <br />
      <label>
        <select name="select6" class="style2" id="select6">
          <option>Select Map Language</option>
          <option>English Version</option>
          <option>Greek Version</option>
        </select>
      </label>
      <br />
      <br />
      <form id="form3" name="form2" method="post" action="">
        <table width="95%" border="0">
          <tr>
            <td width="37%" class="style2">Select Area:</td>
            <td width="63%"><span class="style8">
<!-- WebCruiser start -->            
              <select name="select" class="style2" id="select"  onChange="showArea(this)")" >
                <option value="mapsearch.php?region=Nicosia&channel=gr.talent.channel.cyprus&amp;ulx=525936&amp;uly=3885248&amp;w=14688&amp;h=8960" selected="selected">Nicosia</option>
                <option value="mapsearch.php?region=Larnaca&channel=gr.talent.channel.cyprus&amp;ulx=549744&amp;uly=3859640&amp;w=14688&amp;h=8960">Larnaca</option>
                <option value="mapsearch.php?region=Limassol&channel=gr.talent.channel.cyprus&ulx=497440&uly=3833144&w=14688&h=8960">Limassol</option>
                <option value="mapsearch.php?region=Paphos&channel=gr.talent.channel.cyprus&ulx=440224&uly=3843544&w=14688&h=8960">Paphos</option>
                <option value="mapsearch.php?region=Ayia Napa&channel=gr.talent.channel.cyprus&ulx=589811.9510425703&uly=3871441.5857088603&w=2334&h=1508">Ayia Napa</option>
<!-- WebCruiser end -->            
              </select>
            </span></td>
          </tr>
        </table>
      </form>
      <?php
		echo '
		<form id="searchResultsForm" name="searchResultsForm" method="post" action="'.$_SERVER['PHP_SELF'].'">
			<input type="hidden" name="region" valu="'.$region.'" />
			<input type="hidden" name="listingType" value="'.$listingType.'" />
			<input type="hidden" name="propType" value="'.$propType.'" />
			<input type="hidden" name="minPrice" value="'.$minPrice.'" />
			<input type="hidden" name="maxPrice" value="'.$maxPrice.'" />
			<input type="hidden" name="beds" value="'.$beds.'" />
			<input type="hidden" name="baths" value="'.$baths.'" />
          	<table width="95%" border="0">
		  		<tr>
            	<td width="24%"><span class="style8">Sort by:</span></td>
            	<td width="76%">
				<select name="sort" class="style21" id="sort">
              		<option value="1" '.($sort=="1" ? 'selected' : '').'>Price High-Low</option>
              		<option value="2" '.($sort=="2" ? 'selected' : '').'>Price Low-High</option>
            	</select>
				<input type="submit" name="submit" value="Sort" />
				</td>  
          		</tr>
        	</table>
		</form>';
		?>
        <table width="98%" border="0">
          <tr>
            <td width="63%"><span class="style21"><?php echo ($startRow_rsLisRe + 1) ?>-<?php echo min($startRow_rsLisRe + $maxRows_rsLisRe, $totalRows_rsLisRe) ?> / <span class="style22"><?php echo $totalRows_rsLisRe ?></span> records</span></td>
            <td width="24%" class="style21"><a href="<?php printf("%s?pageNum_rsLisRe=%d%s", $currentPage, max(0, $pageNum_rsLisRe - 1), $queryString_rsLisRe); ?>" class="style211">previous</a></td>
            <td width="13%" class="style21"><a href="<?php printf("%s?pageNum_rsLisRe=%d%s", $currentPage, min($totalPages_rsLisRe, $pageNum_rsLisRe + 1), $queryString_rsLisRe); ?>" class="style211">next</a></td>
          </tr>
        </table>
        <table width="95%" border="0">
          <tr>
            <td height="162"><div id="searchResultsForMap">
              <table width="100%" border="0">
                <tr>
                  <td height="24" colspan="2" class="style21"><strong><?php echo $row_rsLisRe['listingType']; ?></strong> Property,<span class="style211"> <?php echo $row_rsLisRe['region']; ?></span></td>
                </tr>
                <tr>
                  <td width="54%" rowspan="3"><div align="center"><?php echo '<img src=" images/' . $row_rsLisRe['image1'] . '" />' . PHP_EOL;
 ?></div></td>
                  <td width="46%"><span class="style21">&euro;<span class="style211"><?php echo $row_rsLisRe['price']; ?></span></span></td>
                </tr>
                <tr>
                  <td class="style21"><span class="style211"><?php echo $row_rsLisRe['beds']; ?></span> beds | <span class="style211"><?php echo $row_rsLisRe['baths']; ?></span> baths</td>
                </tr>
                <tr>
                  <td class="style21"><span class="style211"><?php echo $row_rsLisRe['coveredArea']; ?></span> area</td>
                </tr>
                <tr>
                  <!-- WebCruiser start -->
                  <td height="16"><a href="" class="style21" onclick="sendMessageToFrame('<?php echo $row_rsLisRe['mapLocation']; ?>');return false;")">Locate</a> <span class="style21"><a href="" class="style21">Save</a><a href="#"></a></span></td>
                  <td><a href="" class="style21" onclick="sendMessageToFrame('channel=gr.talent.channel.cyprus&amp;split-pos=65%');return false;")">Search Nearby</a></td>
                  <!-- WebCruiser end -->
                </tr>
                <tr>
                  <td height="16" colspan="2" class="style21"><a href="/RealEstateOnline/bubbleSample1.php?id=<?php echo $row_rsLisRe['id']; ?>" target="_blank" class="style21">View Details Sample Link</a></td>
                </tr>
              </table>
            </div></td>
        </table>
      </form>
    </div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
<br />
<p><br />
    </p>
    <p>&nbsp;</p>
  </div>
<?php
}
}
if($numrows > $per_page) { 
        echo '<br />'; 
        $page_pad = 2; 
        $min_page = max(1, $cur_page - $page_pad); 
        $max_page = min($total_pages, $cur_page + $page_pad); 
        $show_prev = $cur_page> 1 ? $cur_page - 1 : false; 
        $show_next = $cur_page <$total_pages ? $cur_page + 1 : false; 
        if ($show_prev) { 
                echo "<a class=\"style26\" href=\"?p=1&amp;region=$region&amp;listingType=$listingType&amp;propType=$propType&amp;minPrice=$minPrice&amp;maxPrice=$maxPrice&amp;beds=$beds&amp;baths=$baths&amp;sort=$sort\">&laquo; First</a> "; 
                echo "<a class=\"style26\" href=\"?p=$show_prev&amp;region=$region&amp;listingType=$listingType&amp;propType=$propType&amp;minPrice=$minPrice&amp;maxPrice=$maxPrice&amp;beds=$beds&amp;baths=$baths&amp;sort=$sort\">&lt; Prev</a> "; 
        } 
        for ($page = $min_page; $page <= $max_page; $page++) { 
                if($cur_page<>$page) 
                        echo "<a class=\"style26\" href=\"?p=$page&amp;region=$region&amp;listingType=$listingType&amp;propType=$propType&amp;minPrice=$minPrice&amp;maxPrice=$maxPrice&amp;beds=$beds&amp;baths=$baths&amp;sort=$sort\">$page</a> "; 
                else 
                        echo "<span class=\"style26\">$page </span>"; 
        } 
        if ($show_next) { 
                echo "<a class=\"style26\" href=\"?p=$show_next&amp;region=$region&amp;listingType=$listingType&amp;propType=$propType&amp;minPrice=$minPrice&amp;maxPrice=$maxPrice&amp;beds=$beds&amp;baths=$baths&amp;sort=$sort\">Next &gt;</a> "; 
                echo "<a class=\"style26\" href=\"?p=$total_pages&amp;region=$region&amp;listingType=$listingType&amp;propType=$propType&amp;minPrice=$minPrice&amp;maxPrice=$maxPrice&amp;beds=$beds&amp;baths=$baths&amp;sort=$sort\">Last &raquo;</a>"; 
        } 
} 
?>

Open in new window

Are you sure the database details are correct?  I just ran the code you posted there and I do not get any errors.
yes i copied and pasted it from another page...i will try again
Hi John
Well, it works but there is somethings need to be fixed i tried but it was impossible....i can make it in another question just let me know!!!
What needs to be fixed?
I posted it in another question !!! just check it there :)