ok
Direktori : /home/ngwcolle/public_html/LIBRARY-NGWC/ |
Current File : /home/ngwcolle/public_html/LIBRARY-NGWC/autocomplete.php |
<?php // session_start(); // include "mheader.php"; date_default_timezone_set('Asia/Kolkata'); include "admin/includes/config.php"; // if (isset($_POST['query'])) { // $query = "SELECT * FROM tbl_book WHERE booktitle LIKE '{$_POST['query']}%' LIMIT 100"; // $result = mysqli_query($con, $query); // if (mysqli_num_rows($result) > 0) { // while ($res = mysqli_fetch_array($result)) { // echo $res['booktitle']. "<br/>"; // } // } else { // echo "<div class='alert alert-danger mt-3 text-center' role='alert'>Book not found</div>"; // } // } if (!empty($_POST['search'])) { $Search_Query = $con->real_escape_string($_POST['search']); $query = "SELECT *,count(booktitle) as qty FROM tbl_book WHERE booktitle like '%{$Search_Query}%'; "; $result = $con->query($query) or die($conn->error); $html = ""; if (mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { $html .= '<div class="card col-md-12 my-2 w-100">'; $html .= ' <h5 class="card-title my-1 mx-3">' . $row['booktitle'] . '</h5>'; $html .= ' <h6 class="card-subtitle my-1 mx-3">' . $row['author1'] . $row['author2'].'</h6>'; $html .= '<p class="card-text my-1 mx-3" >' . $row['publisher'] . '</p>'; $html .= '<p class="card-text my-1 mx-3" >' ."Quantity in Self:- " . $row['qty'] . '</p>'; $html .= "</div>"; } } else { $html .= "Sorry! No record found"; } echo $html; } $con->close(); ?>