php - Search form for Prices -


i have form trying search different prices. manage search address , city information prices no search results show up. not sure if in html side or php side going wrong. using 2 drop down lists set number of price ranges.

html

<select name="pricemin">                 <option value="min(900)">900</option>                    <option value="min(1000)">1000</option>                 <option value="min(2000)">2000</option>                    <option value="min(3000)">3000</option>                   <option value="min(4000)">4000</option>                  <option value="min(5000)">5000</option>                  <option value="min(6000)">6000</option>                  <option value="min(7000)">7000</option>                    <option value="min(8000)">8000</option>                        </select>              <select name="pricemax">                 <option value="min(1000)">1000</option>                  <option value="min(2000)">2000</option>                 <option value="min(3000)">3000</option>                    <option value="min(4000)">4000</option>                   <option value="min(5000)">5000</option>                  <option value="min(6000)">6000</option>                  <option value="min(7000)">7000</option>                  <option value="min(8000)">8000</option>                    <option value="min(9000)">9000</option>                        </select> 

php

<?php ////////////connect database goes here////////   ///////////set search variables $property = $_post['property']; $bedroom = $_post['bedroomnumber']; $bathroom = $_post['bathroomnumber']; $pricemin = $_post['pricemin']; $pricemax = $_post['pricemax'];  //////////search $sql = $mysqli->query("select * propertyinfo property '%$property%' , numbed '%$bedroom%' , numbath '%$bathroom%' , price between '%pricemin%' , '%pricemax%'");  if($sql === false) {     die(mysql_error()); // todo: better error handling }  /////////display search results while ($row = $sql->fetch_array(mysqli_assoc)){     echo 'id: '.$row['property'];     echo '<br/> address: '.$row['streetaddress'];     echo '<br/> city: '.$row['city'];     echo '<br/> phone: '.$row['phone'];     echo '<br/> bedroom: '.$row['numbed'];     echo '<br/> bathroom: '.$row['numbath'];     echo '<br/><img src="images/'.$row['imagename1'].'" width="200" height="150" alt=""/>';     }  ?> 

thanks

change this:-

$sql = $mysqli->query("select * propertyinfo property '%$property%' , numbed '%$bedroom%' , numbath '%$bathroom%' , price between '%pricemin%' , '%pricemax%'"); 

to

$sql = $mysqli->query("select * propertyinfo property '%$property%' , numbed '%$bedroom%' , numbath '%$bathroom%' , price between '$pricemin' , '$pricemax'"); 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -