ok

Mini Shell

Direktori : /proc/self/root/home/ngwcolle/www/LIBRARY-NGWC/
Upload File :
Current File : //proc/self/root/home/ngwcolle/www/LIBRARY-NGWC/ajax-live-search.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 = mysqli_real_escape_string($con,$_POST['search']);
    $query = "SELECT distinct(booktitle) FROM tbl_book
    WHERE booktitle LIKE '%{$Search_Query}%'; ";
    $result = $con->query($query) or die($con->error);
    
    $html ='<ul class="list-group" style="margin-top:-15px;">';
    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            $html .= "<li class='list-group-item'><a>" . $row['booktitle'] . "</a></li>";
            
        }
        
    } else {
          $html .= '<li class="list-group-item">Sorry! No record found</li>';
    }
    $html .= "</ul>";
    echo $html;
	
} 
$con->close();
?>

Zerion Mini Shell 1.0