-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearchbookview.php
executable file
·94 lines (60 loc) · 2.29 KB
/
searchbookview.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<style>
.divclick{min-height:30px;}
.a{ color:#000; font-size:12px; font-family:Verdana, Geneva, sans-serif; text-decoration:none;}
.hr:hover{ background:#F90;}
</style>
<table width="578" bgcolor="#F90" border="0" cellspacing="1" style=" text-align:center;margin-top:-51px; margin-left:190px; float:left;" >
<thead>
<tr bgcolor="#F90" height="30" style="font-family:Verdana, Geneva, sans-serif">
<td class="web" width="100"><strong>Book ID</strong></td>
<td class="web" width="400"><strong>Title</strong></td>
<td class="web" width="300"><strong>Author</strong></td>
</tr>
<?php
include('config.php');
if(isset($_POST))
{
$q=$_POST['searchword'];
$sql_res="select b.book_id, title, author_name from book b JOIN book_authors ba ON b.book_id = ba.book_id where
b.book_id like '%$q%' or title like '%$q%' or author_name like '%$q%' ";
$r=mysql_query($sql_res);
$items = 0;
?>
<?php while($row=mysql_fetch_array($r))
{
$href='<a class="a" href="?book_id='.$row['book_id'].'&create">';
$items++;
$bookid=$row['book_id'];
$booktitle=$row['title'];
$author=$row['author_name'];
$re_bookid='<b>'.$q.'</b>';
$re_booktitle='<b>'.$q.'</b>';
$rauthor='<b>'.$q.'</b>';
$f_bookid = str_ireplace($q, $re_bookid, $bookid);
$fbooktitle = str_ireplace($q, $re_booktitle, $booktitle);
$fauthor = str_ireplace($q, $rauthor, $author);
?>
<tr bgcolor="#FFCC99" align="center" class="hr" height="25">
<td width="100"><?php echo $href; ?>
<div class="divclick"><?php echo $f_bookid; ?></div></a>
</td>
<td width="400"><?php echo $href; ?>
<div class="divclick"><?php echo $fbooktitle; ?></div></a>
</td>
<td width="300"><?php echo $href; ?>
<div class="divclick"><?php echo $fauthor; ?></div></a>
</td>
</tr>
<?php
} ?>
<?php
echo "</table>";
if($items==0){ ?>
<div style=" text-align:center; color:#F00; float:left; font-size:20px; font-family:Verdana, Geneva, sans-serif; margin-top:50px;">
"<?php echo $q; ?>"
Search Not Found</div>
<?php }
}
?>
</div>
<br/>