//******************* CONFIG *********************** include('configfile_forsale.php'); mysql_connect($mysql_server,$mysql_username,$mysql_password); mysql_select_db($mysql_database); //************************************************** //Process input data $query = $_GET['q']; $page = $_GET['p']; $minprice = $_GET['minprice']; $maxprice = $_GET['maxprice']; //Get total pages //if($query != '') //{ // if($maxprice != '') { $sqlsearchquery = "SELECT * FROM $scrap_tablename WHERE status LIKE 'f%' ORDER BY id DESC"; // }else{ // $sqlsearchquery = "SELECT * FROM $scrap_tablename WHERE mls LIKE '%$query%' OR location LIKE '%$query%' AND rowprice > '$minprice' ORDER BY sold_date DESC"; } $totalres = mysql_query($sqlsearchquery); //}else{ // if($maxprice != '') // { // $sqlsearchquery = "SELECT * FROM $scrap_tablename WHERE rowprice > '$minprice' AND rowprice < '$maxprice' ORDER BY sold_date DESC"; // }else{ // $sqlsearchquery = "SELECT * FROM $scrap_tablename WHERE rowprice > '$minprice' ORDER BY sold_date DESC"; // } // $totalres = mysql_query($sqlsearchquery); //} //if($query != '' or $minprice != 0 or $maxprice != 'unlimited') //{ // $pagelabel = '(Showing recently sold)'; //}else{ // $pagelabel = '(Showing all listings)'; //} $totalitems = mysql_num_rows($totalres); $maxpage = (int)($totalitems / $items_per_page);$maxpage = $maxpage+1; //Addthis code $addthis = '
'; //Page info if($page <1 or $page > $maxpage){$page=1;} $startfrom = $page-1;$startfrom = $startfrom*$items_per_page; $result = mysql_query($sqlsearchquery." LIMIT $startfrom,$items_per_page"); $table = '