<? include "admin/library/paginator.php"; if($_GET[property_price_range]){ $sqlpricerange = "SELECT * FROM mg_price_range AS pr WHERE pr.price_range_id = $_GET[property_price_range] "; $pricerange = $db->query($sqlpricerange); $rs_pricerange = $db->fetch($pricerange); $price_range_low = $rs_pricerange->price_range_low; $price_range_high = $rs_pricerange->price_range_high; } $sqlpro = "SELECT * FROM mg_property AS p LEFT JOIN mg_location AS loc ON loc.location_id = p.property_location LEFT JOIN mg_noofbed AS nob ON nob.noofbed_id = p.property_bedroom WHERE p.property_id !='' "; if($_GET[property_for]!=""){ $sqlpro .= "AND p.propertyfor_id = '".$_GET[property_for]."' "; } if($_GET[property_type]!=""){ $sqlpro .= "AND p.propertytype_id = '".$_GET[property_type]."' "; } if($_GET[property_location]!=""){ $sqlpro .= "AND p.property_location = '".$_GET[property_location]."' "; } if($_GET[property_price_range]!=""){ $sqlpro .= "AND p.property_price >= '".$price_range_low."' "; $sqlpro .= "AND p.property_price <= '".$price_range_high."' "; } if($_GET[property_noofbed]!=""){ $sqlpro .= "AND p.property_bedroom = '".$_GET[property_noofbed]."' "; } $property = $db->query($sqlpro); $property_row = $db->rows($property); $Per_Page = 5; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]) { $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($property_row<=$Per_Page) { $Num_Pages =1; } else if(($property_row % $Per_Page)==0) { $Num_Pages =($property_row/$Per_Page) ; } else { $Num_Pages =($property_row/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $title = "property_title".$_SESSION["lang"]; $detail = "property_detail".$_SESSION["lang"]; $location = "location_name".$_SESSION["lang"]; $noofbed = "noofbed_name".$_SESSION["lang"]; if($_GET[property_price_range]){ $sqlpricerange = "SELECT * FROM mg_price_range AS pr WHERE pr.price_range_id = $_GET[property_price_range] "; $pricerange = $db->query($sqlpricerange); $rs_pricerange = $db->fetch($pricerange); $price_range_low = $rs_pricerange->price_range_low; $price_range_high = $rs_pricerange->price_range_high; } $sqlpro = "SELECT * FROM mg_property AS p LEFT JOIN mg_location AS loc ON loc.location_id = p.property_location LEFT JOIN mg_noofbed AS nob ON nob.noofbed_id = p.property_bedroom WHERE p.property_id !='' "; if($_GET[property_for]!=""){ $sqlpro .= "AND p.propertyfor_id = '".$_GET[property_for]."' "; } if($_GET[property_type]!=""){ $sqlpro .= "AND p.propertytype_id = '".$_GET[property_type]."' "; } if($_GET[property_location]!=""){ $sqlpro .= "AND p.property_location = '".$_GET[property_location]."' "; } if($_GET[property_price_range]!=""){ $sqlpro .= "AND p.property_price >= '".$price_range_low."' "; $sqlpro .= "AND p.property_price <= '".$price_range_high."' "; } if($_GET[property_noofbed]!=""){ $sqlpro .= "AND p.property_bedroom = '".$_GET[property_noofbed]."' "; } $sqlpro .=" ORDER BY property_id DESC LIMIT $Page_Start , $Per_Page"; $property1 = $db->query($sqlpro); while($rs_pro = $db->fetch($property1)) { ?><table width="150"> <tr> <? $pro_id = $rs_pro->property_id; $sqlimg = "SELECT * FROM mg_propertypic AS p WHERE p.propertypic_property = '$pro_id' GROUP BY propertypic_property"; $propertyimg = $db->query($sqlimg); $propertyimg_row = $db->rows($propertyimg); $rs_img = $db->fetch($propertyimg); if($propertyimg_row!=0){ ?><td> <a href="property-detail<?=$rs_pro->property_id;?>"><img src="admin/property/gallery/server/php/thumbnails/<? if($rs_img->propertypic_name != ""){ echo $rs_img->propertypic_name;}else{ "noimages.jpg";}?>" width="150" height="80" border="0" /></a> <? }else{?> <a href="property-detail<?=$rs_pro->property_id;?>"><img src="images/noimages.jpg" width="150" height="80" border="0" /></a> <? }?> <? if($rs_pro->$title != ""){ echo $rs_pro->$title;}else{ echo $rs_pro->property_titleth;} ?><br> Location : <? if($rs_pro->$location != ""){ echo $rs_pro->$location;}else{ echo $rs_pro->location_nameth;} ?><br> Detail : <? if($rs_pro->$noofbed != ""){ echo $rs_pro->$noofbed;}else{ echo $rs_pro->noofbed_nameth;} ?><br> Price(THB) : <? echo $rs_pro->property_price; ?><br> <a href="property-detail<?=$rs_pro->property_id;?>">Read more »</a> </td> <? $i++; } ?> </tr> </table> <br> Total <?=$property_row;?> Record <? $pages = new Paginator; $pages->items_total = $property_row; $pages->mid_range = 10; $pages->current_page = $Page; $pages->default_ipp = $Per_Page; $pages->url_next = $_SERVER["PHP_SELF"]."?QueryString=value&property_for=$_GET[property_for]&property_type=$_GET[property_type]&property_location=$_GET[property_location]&property_price_range=$_GET[property_price_range]&property_noofbed=$_GET[property_noofbed]&Page="; $pages->paginate(); echo $pages->display_pages() ?>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง