Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- include('properties-Pagination.php');
- ?>
- <?php
- $conn = mysqli_connect("localhost", "root", "B4ck1ight", "admin");
- $Location = "";
- $Type="";
- $priceTo="";
- $advance_search_submit = "";
- $queryCondition = "";
- if(!empty($_POST["search"])) {
- $advance_search_submit = $_POST["advance_search_submit"];
- foreach($_POST["search"] as $k=>$v){
- if(!empty($v)) {
- $queryCases = array("Location","Type");
- if(in_array($k,$queryCases)) {
- if(!empty($queryCondition)) {
- $queryCondition .= " AND ";
- } else {
- $queryCondition .= " WHERE ";
- }
- }
- switch($k) {
- case "Location":
- $Location = $v;
- $wordsAry = explode(" ", $v);
- $wordsCount = count($wordsAry);
- for($i=0;$i<$wordsCount;$i++) {
- if(!empty($_POST["search"]["search_in"])) {
- $queryCondition .= $_POST["search"]["search_in"] . " LIKE '%" . $wordsAry[$i] . "%'";
- } else {
- $queryCondition .= "State LIKE '" . $wordsAry[$i] . "%'";
- }
- if($i!=$wordsCount-1) {
- $queryCondition .= " OR ";
- }
- }
- break;
- case "Type":
- $Type = $v;
- $wordsAry = explode(" ", $v);
- $wordsCount = count($wordsAry);
- for($i=0;$i<$wordsCount;$i++) {
- if(!empty($_POST["search"]["search_in"])) {
- $queryCondition .= $_POST["search"]["search_in"] . " LIKE '%" . $wordsAry[$i] . "%'";
- } else {
- $queryCondition .= "Property_Type LIKE '" . $wordsAry[$i] . "%'";
- }
- if($i!=$wordsCount-1) {
- $queryCondition .= " OR ";
- }
- }
- }
- }
- }
- }
- ?>
- <html>
- <head>
- <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
- <link href="http://fonts.googleapis.com/css?family=Cookie" rel="stylesheet" type="text/css">
- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.css">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
- <script src="jquery.range.js"></script>
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
- <link type="text/css" rel="stylesheet" href="assets/css/bootstrap.min.css">
- <link type="text/css" rel="stylesheet" href="assets/css/jquery.mCustomScrollbar.css">
- <link type="text/css" rel="stylesheet" href="assets/fonts/font-awesome/css/font-awesome.min.css">
- <link type="text/css" rel="stylesheet" href="assets/fonts/flaticon/font/flaticon.css">
- <title>NS-Property Listing</title>
- <style><?php include 'properties-Listing.css'; ?></style>
- <style>
- .search-box {
- padding: 30px;
- background-color:#C8EEFD;
- display:inline-block;
- }
- .search-label{
- margin:2px;
- display:inline-block;
- }
- .demoInputBox {
- padding: 10px;
- border: 0;
- border-radius: 4px;
- margin: 0px 5px 15px;
- width: 250px;
- display:inline-block;
- }
- .btnSearch{
- padding: 10px;
- background: #84D2A7;
- border: 0;
- border-radius: 4px;
- margin: 0px 5px;
- color: #FFF;
- width: 150px;
- display:inline-block;
- }
- #advance_search_link {
- color: #001FFF;
- cursor: pointer;
- display:inline-block;
- }
- </style>
- <script>
- function openForm() {
- document.getElementById("myForm").style.display = "block";
- }
- function closeForm() {
- document.getElementById("myForm").style.display = "none";
- }
- </script>
- </head>
- <body>
- <div class="bodyy">
- <div class="website">
- <a href="home.php"> <p style="color:white">NS Property Website</p>
- </div>
- <div class="topnav" id="myTopnav">
- <a href="../Frontend/Home/index.php">Home</a>
- <a href="properties.php" class="active">Property</a>
- <a href="../Frontend/Home/Contact Us/Contact.php">Contact</a>
- <a href="new.php">News</a>
- <a href="../Frontend/Home/About Us/About.php" >About</a>
- <a href="javascript:void(0);" class="icon" onclick="myFunction()">
- <i class="fa fa-bars"></i>
- </a>
- </div>
- </div>
- <div>
- <button class="open-button" onclick="openForm()">Search</button>
- <div class="form-popup" id="myForm">
- <form name="frmSearch" class="form-container" method="post" action="properties.php">
- <input type="hidden" id="advance_search_submit" name="advance_search_submit" value="<?php echo $advance_search_submit; ?>">
- <div class="search-box">
- <label class="search-label">Location</label>
- <div>
- <select name="search[Location]" class="demoInputBox">
- <option value=""> select the location</option>
- <option value="Johor Bahru Kedah Kelantan Kuala Lumpur Labuan Melaka Negeri Sembilan Pahang Perak Perlis Pulau Pinang Putra Jaya Sabah Sarawak Terengganu Selangor">All Location</option>
- <option value="Johor">Johor Bahru</option>
- <option value="Kedah">Kedah</option>
- <option value="Kelantan">Kelantan</option>
- <option value="Kuala Lumpur">Kuala Lumpur</option>
- <option value="Labuan">Labuan</option>
- <option value="Melaka">Melaka</option>
- <option value="Negeri Sembilan">Negeri Sembilan</option>
- <option value="Pahang">Pahang</option>
- <option value="Perak">Perak</option>
- <option value="Perlis">Perlis</option>
- <option value="Pulau Pinang">Pulau Pinang</option>
- <option value="Putra Jaya">Putra Jaya</option>
- <option value="Sabah">Sabah</option>
- <option value="Sarawak">Sarawak</option>
- <option value="Terengganu">Terengganu</option>
- <option value="Selangor">Seleangor</option>
- </select>
- </div>
- <label class="search-label">Property Type</label>
- <div>
- <select name="search[Type]" class="demoInputBox">
- <option value=""> select the Property Type</option>
- <option value="Apartment/Condominium/Soho/FLAT">Apartment/Condominium/Soho/Flat</option>
- <option value="Terrace/Townhouse">Terrace/TownHouse</option>
- <option value="Bungalow/SemiDetached">Bungalow/Semi-D</option>
- </select>
- </div>
- <div>
- <button type="submit" class="btn">Search</button>
- <button type="button" class="btn cancel" onclick="closeForm()">Close</button>
- </div>
- </div>
- </form>
- </div>
- </div>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p style="text-align:center"> </p>
- <p1>Propery Listing</p1>
- <hr>
- <!-- Properties list fullwidth start -->
- <div class="properties-list-fullwidth content-area-2">
- <div class="container">
- <div class="row">
- <?php
- $query=mysqli_query($conn,"select * from property $offset,$total_records_per_page" . $queryCondition);
- ?>
- <?php while($row = mysqli_fetch_array($query)) {
- $id=$row['id'];
- $img=$row['image'];
- ?>
- <div class="col-lg-4 col-md-6 col-sm-12">
- <div class="property-box">
- <div class="property-thumbnail">
- <div class="size">
- <a href="properties-details.html" class="property-img">
- <div class="tag button alt featured"><?php echo $row['State'];?></div>
- <div class="price-ratings-box">
- <p class="price">
- RM <?php echo $row['Price'];?>.00
- </p>
- </div>
- <img src="upload/<?php echo $img;?>" alt="property-1" class="img-fluid" id="size">
- </a>
- </div>
- <div class="property-overlay">
- <a href="detail.php?id=<?php echo $id;?>" class="overlay-link">
- <i class="fa fa-link"></i>
- </a>
- <!-- <a class="overlay-link property-video" title="Test Title">
- <i class="fa fa-video-camera"></i>
- </a>-->
- </div>
- </div>
- <div class="detail">
- <h1 class="title">
- <a href="detail.php?id=<?php echo $id;?>"><?php echo $row['Property_Title'];?></a>
- <br><br>
- <a href="detail.php?id=<?php echo $id;?>" style="font-size:16px" id="formating"><?php echo $row['Property_Type'];?></a>
- </h1>
- <div class="location">
- <a href="detail.php?id=<?php echo $id;?>">
- </a>
- </div>
- </div>
- </div>
- </div>
- <?php } ?>
- </div>
- </div>
- </div>
- <div>
- <div><strong><?php echo $row["Property_Type"]; ?></strong></div>
- <div class="result-description"><?php echo $row["Description"]; ?></div>
- </div>
- </div>
- <ul class="pagination">
- <li <?php if($page_no <= 1){ echo "class='disabled'"; } ?>>
- <a <?php if($page_no > 1){ echo "href='?page_no=$previous_page'"; } ?>>Previous</a>
- </li>
- <?php
- if ($total_no_of_pages <= 10){
- for ($counter = 1; $counter <= $total_no_of_pages; $counter++){
- if ($counter == $page_no) {
- echo "<li class='active'><a>$counter</a></li>";
- }else{
- echo "<li><a href='?page_no=$counter'>$counter</a></li>";
- }
- }
- }
- elseif($total_no_of_pages > 10){
- if($page_no <= 4) {
- for ($counter = 1; $counter < 8; $counter++){
- if ($counter == $page_no) {
- echo "<li class='active'><a>$counter</a></li>";
- }else{
- echo "<li><a href='?page_no=$counter'>$counter</a></li>";
- }
- }
- echo "<li><a>...</a></li>";
- echo "<li><a href='?page_no=$second_last'>$second_last</a></li>";
- echo "<li><a href='?page_no=$total_no_of_pages'>$total_no_of_pages</a></li>";
- }
- elseif($page_no > 4 && $page_no < $total_no_of_pages - 4) {
- echo "<li><a href='?page_no=1'>1</a></li>";
- echo "<li><a href='?page_no=2'>2</a></li>";
- echo "<li><a>...</a></li>";
- for ($counter = $page_no - $adjacents; $counter <= $page_no + $adjacents; $counter++) {
- if ($counter == $page_no) {
- echo "<li class='active'><a>$counter</a></li>";
- }else{
- echo "<li><a href='?page_no=$counter'>$counter</a></li>";
- }
- }
- echo "<li><a>...</a></li>";
- echo "<li><a href='?page_no=$second_last'>$second_last</a></li>";
- echo "<li><a href='?page_no=$total_no_of_pages'>$total_no_of_pages</a></li>";
- }
- else {
- echo "<li><a href='?page_no=1'>1</a></li>";
- echo "<li><a href='?page_no=2'>2</a></li>";
- echo "<li><a>...</a></li>";
- for ($counter = $total_no_of_pages - 6; $counter <= $total_no_of_pages; $counter++) {
- if ($counter == $page_no) {
- echo "<li class='active'><a>$counter</a></li>";
- }else{
- echo "<li><a href='?page_no=$counter'>$counter</a></li>";
- }
- }
- }
- }
- ?>
- <li <?php if($page_no >= $total_no_of_pages){ echo "class='disabled'"; } ?>>
- <a <?php if($page_no < $total_no_of_pages) { echo "href='?page_no=$next_page'"; } ?>>Next</a>
- </li>
- <?php if($page_no < $total_no_of_pages){
- echo "<li><a href='?page_no=$total_no_of_pages'>Last ››</a></li>";
- } ?>
- </ul>
- <footer class="footer-distributed">
- <div class="footer-left">
- <h3>NS<span>Property Website</span></h3>
- <p4 class="footer-links">
- <a href="#">Home</a>
- ·
- <a href="#">Property</a>
- .
- ·
- <a href="#">News</a>
- ·
- <a href="#">About</a>
- ·
- <a href="#">Contact</a>
- </p4>
- <br>
- <p4 class="footer-company-name">NS Property © 2020</p4>
- </div>
- <div class="footer-center">
- <div>
- <i class="fa fa-map-marker"></i>
- <p4><span>Lot 24,Jalan Permas 5/20</span> Mount Austin, Malaysia</p4>
- </div>
- <div>
- <i class="fa fa-phone"></i>
- <p4>+60 016-723-5122</p4>
- </div>
- <div>
- <i class="fa fa-envelope"></i>
- <p4><a href="mailto:suakaiyoung00815@gmail.com">suakaiyoung0815@gmail.com</a></p4>
- </div>
- </div>
- <div class="footer-right">
- <p4 class="footer-company-about">
- <span>About the company</span>
- Property Website is to provide information and service to the customer & Property Agent.
- </p4>
- <div class="footer-icons">
- <a href="#"><i class="fa fa-facebook"></i></a>
- <a href="#"><i class="fa fa-twitter"></i></a>
- <a href="#"><i class="fa fa-linkedin"></i></a>
- <a href="#"><i class="fa fa-github"></i></a>
- </div>
- </div>
- </footer>
- <script>
- function myFunction() {
- var x = document.getElementById("myTopnav");
- if (x.className === "topnav") {
- x.className += " responsive";
- } else {
- x.className = "topnav";
- }
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement