[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

Php Real Estate Script

Well I have removed the map so there is not any info we dont need right now...
so the problems are...
a. Your code was with 1 listing per page....i made it to 5 but they do not appear one under the other....my page with all the graphics repeats .....I tried repositioning the divs but it did not work....
b. I added the code to the region like the other update criteria and i added a submit button for the user to change regions, that did not work either and
c. I put the next and previous on top of  the listing results but they did not work when I put them there......you had them at the bottom but they should be up there where I have them in the code below...
by the way the problem earlier was that on my index page I was calling mapsearch.php?region=Nicosia, thats why I was getting the error....
note that the db connection settings are on top of my page, not visible here...
<?php
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 = 1; 
$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>


      </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="<?php echo $_SERVER['PHP_SELF']; ?>">
        <table width="95%" border="0">
          <tr>
            <td width="50%" class="style2"><select name="region2" class="style21" id="region" size="">
              <option selected="selected">Region</option>
              <option value="'Nicosia','Larnaca','Limassol','Paphos','Ayia Napa'">Any</option>
              <option value="'Nicosia'" <?php echo ($region=="'Nicosia'" ? 'selected' : ''); ?>>Nicosia</option>
              <option value="'Larnaca'" <?php echo ($region=="'Larnaca'" ? 'selected' : ''); ?>>Larnaca</option>
              <option value="'Limassol'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Limassol</option>
              <option value="'Paphos'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Paphos</option>
              <option value="'Ayia Napa'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Ayia Napa</option>
            </select></td>
            <td width="50%" class="style2"><label>
              <input type="submit" name="button3" id="button3" value="Submit" />
            </label></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="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><div align="right">
              <?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>"; 
        } 
} 
?>
            </div></td>
        </tr>
      </table>
      </form>
      <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>
            <td height="16" class="style21">Locate Save<a href="#"></a></td>
            <td class="style21">Search Nearby</td>
          </tr>
        </table>
      </div>
    </div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
<br />
<p><br />
    </p>
    <p>&nbsp;</p>
  </div>

Open in new window

0
dino_angelides
Asked:
dino_angelides
  • 3
  • 2
1 Solution
 
dino_angelidesAuthor Commented:
This is the code with the changes I have made...the only 2 problems now are..

a. When I put 5 per page, it shows one listing and the others are repeating the whole <div id="mainContent"> i tried to remove the code and put it somewhere else, i got somewhere but still there was a problem...

b. the select region drop down menu works just fine along with the other update criteria...the problem is that i want the No Results to be appearing on the left where the listing results are appeared in case there is no listing available!!!!
<?php
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 = 1; 
$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 name="button2" type="submit" class="style2" id="button2" value="Search" />
            </span></td>
          </tr>
        </table>


      </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="50%" class="style2"><select name="region" class="style21" id="region" size="">
              <option value="'Nicosia','Larnaca','Limassol','Paphos','Ayia Napa'"  <?php echo ($region=="'Nicosia','Larnaca','Limassol','Paphos','Ayia Napa'" ? 'selected' : ''); ?> selected="selected">Any</option>
              <option value="'Nicosia'" <?php echo ($region=="'Nicosia'" ? 'selected' : ''); ?>>Nicosia</option>
              <option value="'Larnaca'" <?php echo ($region=="'Larnaca'" ? 'selected' : ''); ?>>Larnaca</option>
              <option value="'Limassol'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Limassol</option>
              <option value="'Paphos'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Paphos</option>
              <option value="'Ayia Napa'" <?php echo ($region=="'Flat'" ? 'selected' : ''); ?>>Ayia Napa</option>
            </select></td>
            <td width="50%" class="style2"><label>
              <input type="submit" name="button3" id="button3" class="style2" value="Submit" />
            </label></td>
           
          </tr>
     
        </table>
      </form>
      <?php
		echo '
		<form id="searchResultsForm" name="searchResultsForm" method="post" action="'.$_SERVER['PHP_SELF'].'">
			<input type="hidden" name="region" value="'.$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="76%">
				<select name="sort"  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" class="style2" value="Sort" />
				</td>  
          		</tr>
        	</table>
		</form>';
		?>

   
      <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>
            <td height="16" class="style21">Locate Save<a href="#"></a></td>
            <td class="style21">Search Nearby</td>
          </tr>
        </table>
        <div align="right">
          <?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=\"style21\" 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=\"style21\" 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=\"style21\" 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=\"style21\">$page </span>"; 
        } 
        if ($show_next) { 
                echo "<a class=\"style21\" 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=\"style21\" 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>"; 
        } 
} 
?>
        </div>
      </div>
    </div>
  </div>

Open in new window

0
 
dino_angelidesAuthor Commented:
Ok i fixed part b :) part a is a bit tough
0
 
john-formbyCommented:
Ok, this is the problem with working on code you can't run :-)

Anyway, in answer to your questions:

It was the while loop that needed moving to stop the code from repeating
Your original code had the name region2 on the form tag.  It should have been region
The page links worked fine for me so not sure what this issue is?

Please have a look at the updated code below.

Hope this helps,

John
<?php
$dbHost = "localhost";
$dbUser = "YOUR_USERNAME";
$dbPass = "YOUR_PASSWORD";
$dbName = "YOUR_DATABASE";
$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 IN($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 IN($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 IN($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 IN($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); 
?> 

<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>


      </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="<?php echo $_SERVER['PHP_SELF']; ?>">
      		<input type="hidden" name="listingType" value="<?php echo $listingType; ?>" />
			<input type="hidden" name="propType" value="<?php echo $propType; ?>" />
			<input type="hidden" name="minPrice" value="<?php echo $minPrice; ?>" />
			<input type="hidden" name="maxPrice" value="<?php echo $maxPrice; ?>" />
			<input type="hidden" name="beds" value="<?php echo $beds; ?>" />
			<input type="hidden" name="baths" value="<?php echo $baths; ?>" />
			<input type="hidden" name="sort" value="<?php echo $sort; ?>" />
        <table width="95%" border="0">
          <tr>
            <td width="50%" class="style2"><select name="region" class="style21" id="region" size="">
              <option value="'Nicosia','Larnaca','Limassol','Paphos','Ayia Napa'" <?php echo ($region=="'Nicosia','Larnaca','Limassol','Paphos','Ayia Napa'" ? 'selected' : ''); ?>>Any</option>
              <option value="'Nicosia'" <?php echo ($region=="'Nicosia'" ? 'selected' : ''); ?>>Nicosia</option>
              <option value="'Larnaca'" <?php echo ($region=="'Larnaca'" ? 'selected' : ''); ?>>Larnaca</option>
              <option value="'Limassol'" <?php echo ($region=="'Limassol'" ? 'selected' : ''); ?>>Limassol</option>
              <option value="'Paphos'" <?php echo ($region=="'Paphos'" ? 'selected' : ''); ?>>Paphos</option>
              <option value="'Ayia Napa'" <?php echo ($region=="'Ayia Napa'" ? 'selected' : ''); ?>>Ayia Napa</option>
            </select></td>
            <td width="50%" class="style2"><label>
              <input type="submit" name="button3" id="button3" value="Submit" />
            </label></td>
          </tr>
        </table>
      </form>
      <?php
		echo '
		<form id="searchResultsForm" name="searchResultsForm" method="post" action="'.$_SERVER['PHP_SELF'].'">
			<input type="hidden" name="region" value="'.$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="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><div align="right">
              <?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>"; 
        } 
} 
?>
            </div></td>
        </tr>
      </table>
      <div id="searchResultsForMap">
      <?php
    	if($numrows <= 0) {   
    		echo 'No Results';   
		} else {   
    		while($row_rsLisRe = mysql_fetch_array($result)) { 
      ?>   
        <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>
            <td height="16" class="style21">Locate Save<a href="#"></a></td>
            <td class="style21">Search Nearby</td>
          </tr>
        </table>
        
      <?php
	  }
	  }
	  ?>  
      </div>
    </div>
    <br />
    <br />
    <br />
    <br />
    <br />
    <br />
<br />
<p><br />
    </p>
    <p>&nbsp;</p>
  </div>

Open in new window

0
 
dino_angelidesAuthor Commented:
Hi John I saw that too eventually it was a bit weird to do that but it was awesome to make it work!!! Thx again
0
 
john-formbyCommented:
No problem :-)  Off to bed now.  If you post any more questions, I will look in the morning :-)
0

Featured Post

Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now