-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathland.php
More file actions
42 lines (37 loc) · 1.35 KB
/
Copy pathland.php
File metadata and controls
42 lines (37 loc) · 1.35 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
42
<?php
include('db.php');
$re=$_GET['r'];
$req="select * from request where request_id='$re'";
$r=mysqli_query($con,$req);
$rr=mysqli_fetch_assoc($r);
$book=$rr['book_id'];
$student=$rr['student_ID'];
$reb="select * from books where book_id='$book'";
$rb=mysqli_query($con,$reb);
$b=mysqli_fetch_assoc($rb);
$bookt=$b['book_title'];
$bookqty=$b['book_qty'];
//-----------------
$res="select * from students where student_ID='$student'";
$rs=mysqli_query($con,$res);
$s=mysqli_fetch_assoc($rs);
$stud=$s['student_ID'];
$books=$s['books']+1;
$date=date('d-m-y');
$futuredate = strtotime("3 days");
$deadline=date('d-m-y', $futuredate);
$sat='out';
//echo $date; echo $deadline; echo $stud; echo $bookt; echo $sat;
$sqld="insert into land (time,deadline,student_ID,book,book_id,status) values ('$date','$deadline','$stud','$bookt','$book','$sat') ";
$sqls="update students set books='$books' where student_id='$student'";
$sqle="delete from request where request_id='$re'";
mysqli_query($con,$sqld);
mysqli_query($con,$sqls);
mysqli_query($con,$sqle);
session_start();
$_SESSION['message']="Book Successfully Lended";
header('Location: index.php?page=req');
/*if(mysqli_affected_rows()>0){
header('location:index.php?page=admin');}
else{echo "bad";}*/
?>