-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfindborrower.php
executable file
·133 lines (94 loc) · 3.09 KB
/
findborrower.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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<style>
.hr:hover{ background:#F90;}
.del:hover{ background:#FFF;}
</style>
<div class="display_box">
<table width="850" border="0" cellspacing="1" style=" margin-left:20px;background:#F90; font-size:12px; font-family:Verdana, Geneva, sans-serif;">
<?php
include('config.php');
if(isset($_POST))
{
$q=$_POST['searchword'];
$sql_res="select * from borrower where card_no like '%$q%' or fname like '%$q%' or lname like '%$q%' ";
$r=mysql_query($sql_res);
$items = 0;
?>
<?php while($row=mysql_fetch_array($r))
{
$items++;
$bookid=$row['card_no'];
$booktitle=$row['fname'];
$author=$row['lname'];
$re_bookid='<b>'.$q.'</b>';
$re_booktitle='<b>'.$q.'</b>';
$rcallnumber='<b>'.$q.'</b>';
$rauthor='<b>'.$q.'</b>';
$rauthor1='<b>'.$q.'</b>';
$rauthor2='<b>'.$q.'</b>';
$rpublish='<b>'.$q.'</b>';
$rsubject='<b>'.$q.'</b>';
$rsection='<b>'.$q.'</b>';
$f_bookid = str_ireplace($q, $re_bookid, $bookid);
$fbooktitle = str_ireplace($q, $re_booktitle, $booktitle);
$fcallnumber = str_ireplace($q, $rcallnumber, $callnumber);
$fauthor = str_ireplace($q, $rauthor, $author);
$fauthor1 = str_ireplace($q, $rauthor1, $author1);
$fauthor2 = str_ireplace($q, $rauthor2, $author2);
$fpublish = str_ireplace($q, $rpublish, $publish);
$fsubject = str_ireplace($q, $rsubject, $subject);
$fsection = str_ireplace($q, $rsection, $section);
?>
<tr bgcolor="#FFCC99" height="25" class="hr" align="center">
<td width="230">
<?php echo $f_bookid; ?>
</td>
<td width="250">
<?php echo $fbooktitle; ?>
</td>
<td width="250"> <?php echo $fauthor; ?></td>
<td align="center" class="del"><a title="EDIT" href="?addBorrower&card_no=<?php echo $row['card_no']; ?>">Edit</a></td>
<td class="del">
<?php echo '<div align="center"><a href="#" id="'.$row['card_no'].'" class="delbutton" title="Click To Delete">Delete</a></div>'; ?>
</td>
</tr>
<?php
} ?>
<?php
echo "";
if($items==0){ ?>
<div style=" text-align:center; color:#F00; font-size:20px; font-family:Verdana, Geneva, sans-serif; margin-top:50px;">
"<?php echo $_POST['searchword']; ?>"
Search Not Found</div>
<?php } ?>
<tr height="25">
<td colspan="6">
</td>
</tr>
</table>
<?php }?>
<script type="text/javascript">
$(function() {
$(".delbutton").click(function(){
//Save the link in a variable called element
var element = $(this);
//Find the id of the link that was clicked
var del_id = element.attr("id");
//Built a url to send
var info = 'studentid=' + del_id;
if(confirm("Are you sure you want to delete this Borrower?"))
{
$.ajax({
type: "GET",
url: "delete.php",
data: info,
success: function(){
}
});
$(this).parents(".hr").animate({ backgroundColor: "#fbc7c7" }, "fast")
.animate({ opacity: "hide" }, "slow");
}
return false;
});
});
</script>
</div>