Viewing file: search.php (4.34 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
include 'index_Include.php'; $_SESSION['page'] = 'search.php';
$all_row = 0; if (isset($_GET[keyword])&&$_GET[keyword]!='') {
// --------- $product_sql = "SELECT * FROM product WHERE "; $keyword = $_GET['keyword']; $keyword = str_replace("'","'",$keyword); $keyword = str_replace("\"",""",$keyword); $Q = 1; if ($Q==1) { $product_sql .= " ( product_name LIKE '%$keyword%' OR product_detail LIKE '%$keyword%' OR product_review LIKE '%$keyword%' )"; $Q++; } else{ $product_sql .= " AND ( product_name LIKE '%$keyword%' OR product_detail LIKE '%$keyword%' OR product_review LIKE '%$keyword%' ) "; $Q++; } $product_sql .= " ORDER BY product_id DESC limit 20"; $product_qr = mysqli_query($con,$product_sql); $product_row = mysqli_num_rows($product_qr); $all_row += $product_row; // ---------
// --------- $portfolio_sql = "SELECT * FROM portfolio WHERE "; $keyword = $_GET['keyword']; $keyword = str_replace("'","'",$keyword); $keyword = str_replace("\"",""",$keyword); $Q = 1; if ($Q==1) { $portfolio_sql .= " ( portfolio_name LIKE '%$keyword%' OR portfolio_detail LIKE '%$keyword%' OR portfolio_review LIKE '%$keyword%' )"; $Q++; } else{ $portfolio_sql .= " AND ( portfolio_name LIKE '%$keyword%' OR portfolio_detail LIKE '%$keyword%' OR portfolio_review LIKE '%$keyword%' ) "; $Q++; } $portfolio_sql .= " ORDER BY portfolio_id DESC limit 20"; $portfolio_qr = mysqli_query($con,$portfolio_sql); $portfolio_row = mysqli_num_rows($portfolio_qr); $all_row += $portfolio_row; // ---------
}
?> <!DOCTYPE html> <html> <head> <? if (isset($_GET[keyword])&&$_GET[keyword]!='') { ?> <title> ค้นหา : <? echo $keyword; ?> | <? echo $fixed[fixed_website]; ?> </title> <meta name="description" content=" <? echo $fixed[fixed_topic]; ?> - <? echo $fixed[fixed_company]; ?> "> <meta name="keywords" content="<? echo $fixed[fixed_topic]; ?>"> <meta name="author" content="<? echo $fixed[fixed_topic]; ?>"> <? } ?> <? include 'index_head.php'; ?> </head> <body> <? include 'index_navbar.php'; ?> <div style="background-color: #f0f0f0;"> <div class="container between20"> <div class="row"> <div class="col-md-12 text-center"> <span class="page-topic color1 "> <? if (isset($_GET[keyword])&&$_GET[keyword]!='') { ?> ค้นหา : <? echo $keyword; ?> <? } ?> <? if ($all_row=='0') { echo " (ไม่พบข้อมูล)"; } else{ ?> <span class="badge"> <? echo number_format($all_row); ?> รายการ </span> <? } ?> </span> </div> </div> </div> </div> <div> <div class="container "> <!-- row --> <? if ($product_row>0) { ?> <p class="size20 bold"> พบ อสังหาริมทรัพย์ : <? echo $product_row; ?> รายการ </p> <? $x = 1; while ($product = mysqli_fetch_array($product_qr)) { if ($x==1) { ?> <div class="row"> <?php } ?> <div class="col-md-3 col-xs-6"> <? include 'index_panel_product.php'; ?> </div> <?php if ($x==4) { $x=0; ?> </div> <? } $x++; } if ($x!=1) { echo "</div>"; } } ?> <!-- row -->
<!-- row --> <? if ($portfolio_row>0) { ?> <p class="size20 bold"> พบ ผลงาน : <? echo $portfolio_row; ?> รายการ </p> <? $x = 1; while ($portfolio = mysqli_fetch_array($portfolio_qr)) { if ($x==1) { ?> <div class="row"> <?php } ?> <div class="col-md-6"> <? include 'index_panel_portfolio.php'; ?> </div> <?php if ($x==2) { $x=0; ?> </div> <? } $x++; } if ($x!=1) { echo "</div>"; } } ?> <!-- row -->
<div class="row hidden-sm hidden-xs margintop30" > <div class="col-md-12"> <ul class="breadcrumb no-radius" style="margin-bottom: 0px;"> <li><a href="index.php">หน้าแรก</a></li> <li> <a onclick="goBack();" href="#"> กลับ </a> </li> </ul> </div> </div> </div> </div> <!-- container --> <? include 'index_footer.php'; ?> </body> </html>
|