-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsearchallbooks.php
executable file
·73 lines (51 loc) · 1.51 KB
/
searchallbooks.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
<style>
.del:hover{ background:#FFF;}
</style>
<div class="display_box">
<table width="853" border="0" cellspacing="1" style=" margin-left:20px;font-size:12px; font-family:Verdana, Geneva, sans-serif;">
<thead>
<?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))
{
$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 $f_bookid; ?>
</td>
<td width="400">
<?php echo $fbooktitle; ?>
</td>
<td width="200"> <?php echo $fauthor; ?></td>
<?php
} ?>
<tr height="20px" bgcolor="#f90">
<td colspan="4" height="25"></td>
</tr>
<?php
echo "</table>";
if($items==0){ ?>
<div style=" text-align:center; color:#F00; font-size:20px; font-family:Verdana, Geneva, sans-serif; margin-top:50px;">
"<?php echo $q; ?>"
Search Not Found</div>
<?php }
}
?><br/>