-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsearch.php
More file actions
41 lines (39 loc) · 1.11 KB
/
search.php
File metadata and controls
41 lines (39 loc) · 1.11 KB
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
<?php
session_start();
if (isset($_SESSION['email'])){
echo file_get_contents("header2.html");
}
else {
echo file_get_contents("header.html");
}
$conn = mysqli_connect("localhost", "root", "");
mysqli_select_db($conn, "mydb2");
if (!$conn)
{
die('connection failed');
}
//'%".$_GET['q']."%';";
extract($_GET);
$query = "Select * from proj_books_1 where b_Name like '%".$_GET['search']."%';";
$res = mysqli_query($conn, $query);
if(mysqli_num_rows(mysqli_query($conn, $query)) == 0)
{
echo "<div class='topPart'><p>No results found!</p></div></body>";
}
else
{
$rows = mysqli_fetch_assoc($res);
while($rows)
{
echo '<div class = "topPart" style="height:280px;"><p>
<ul>
<li><h3>'. $rows['b_Name'].'</h3></li>
<p><b><i>-'.$rows['b_Author']. '</i></b></p>
<img src="'. $rows['b_Img_src']. '" alt="'.$rows['b_Name'].'" align="left" style="width:160px;height:170px;padding-right:20px"/>
<p><b> '.$rows['b_Describe'].'</b></p>
</ul></p>';
echo '</div></div></body>';
$rows = mysqli_fetch_assoc($res);
}
}
?>