-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
69 lines (64 loc) · 2.39 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous">
</head>
<style>
<?php include 'style.css';?>
</style>
<body>
<?php include 'navbar.php';?>
<br>
<div class="container-fluid">
<img class="img-fluid" src="image/library.jpg" width="2500px" >
<div class="centered">
<form class="form-inline" method="GET">
<input type="text" name="search" required value="<?php if(isset($_GET['search'])){echo $_GET['search']; } ?>" class="form-control" placeholder="Search data">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</div>
<br>
<div class="container">
<div class="row cols-3">
<div>
<?php
include 'conn.php';
if(isset($_GET['search']))
{
$value = $_GET['search'];
$query = " SELECT * FROM books WHERE book LIKE '%$value%' OR author LIKE '%$value%' ";
$query_run = mysqli_query($con, $query);
if(mysqli_num_rows($query_run) > 0)
{
foreach($query_run as $items)
{
?>
<div class="card-group" >
<div class="card text-white bg-success mb-3">
<img src="" class="card-img-top">
<div class="card-body">
<h5 class="card-title"><?= $items['book']; ?></h5>
<h6 class="card-title">by -<?= $items['author']; ?></h6>
<p class="card-text"><?= $items['discription']; ?></p>
</div>
</div>
<?php
}
}
else
{
echo '<script> alert("Sorry No Book Found!") </script>';
}
}
?>
</div>
</div>
</div>
<?php include 'footer.php';?>
</body>
</html>