-
Notifications
You must be signed in to change notification settings - Fork 10
/
ADissue.php
71 lines (45 loc) · 1.65 KB
/
ADissue.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
<?php
include 'conn.php';
$request_id=$_GET['request_id'];
$result=$mysqli->query("SELECT * FROM requestbook where Request_id=$request_id");
$row = $result->fetch_array();
$request_id=$row['Request_id'];
$mid=$row['Mid'];
$name=$row['Name'];
$bid=$row['Bid'];
$bname=$row['Bname'];
//insert request record into issue table
$sql=$mysqli->query("INSERT INTO issuebook(Request_id,Mid,Name,Bid,Bname,Issue_date,validreturndate)
VALUES('$request_id','$mid','$name','$bid','$bname',now(),ADDDATE(now(),8))");
$result=$mysqli->query($sql);
$sql4=$mysqli->query("update book set Availability='no' where Bid='$bid'");
$query=$mysqli->query("select * from member where Mid='$mid'");
while ($r=$query->fetch_array())
{
$book1=$r['Book1'];
}
if($book1==NULL)
{
$sql2=$mysqli->query("update member set Book1='$bid' where Mid='$mid'");
}
else
{
$sql3=$mysqli->query("update member set Book2='$bid' where Mid='$mid'");
}
//insert issue record into issuestore
$sql=$mysqli->query("select * from issuebook where Request_id='$request_id'");
while ($row=$sql->fetch_array())
{
$Issue_id=$row['Issue_id'];
$mid=$row['Mid'];
$name=$row['Name'];
$bid=$row['Bid'];
$bname=$row['Bname'];
$sql=$mysqli->query("INSERT INTO issuestore(Issue_id,Mid,Name,Bid,Bname,Issue_date,validreturndate)
VALUES('$Issue_id','$mid','$name','$bid','$bname',now(),ADDDATE(now(),8))");
}
//delete request record
$sql1=$mysqli->query("DELETE FROM requestbook WHERE Request_id='$request_id'");
$result1=$mysqli->query($sql1);
header ('location:admin.php');
?>