forked from k493r0/EqManage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fetchReturnAllRq.php
37 lines (32 loc) · 1.25 KB
/
fetchReturnAllRq.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
<?php
session_start();
if(!isset($_SESSION['loggedin'])){
header('Location: login.php');
exit();
}
if ($_SESSION['username'] != 'administrator'){
header('Location: index.php?adminonly=1');
}
include('serverconnect.php');
$userPOSTID = $_POST['id'];
$equipmentID = $_POST['eqID'];
$result = mysqli_query($db, "Select u.fullname, u.id, l.users_id, l.checkoutRequests_id, l.checkoutRequestDate, l.expectedReturnDate
from users u
left join log l on u.id = l.users_id
left join equipment e on l.equipment_id = e.id
where e.id = '$equipmentID' and l.returnDate IS NULL and l.users_id = '$userPOSTID' and l.checkoutDate IS NOT NULL"); //Checked out but not returned
$users_arr = array();
while ($row = mysqli_fetch_array($result)) {
$equipmentName = $row['equipment'];
$equipmentID = $row['id'];
$barcodeID = $row['barcodeID'];
$fullname = $row['fullname'];
$returnDate = $row['expectedReturnDate'];
$fullname = $row['fullname'];
$userID = $row['users_id'];
$returnDate = $row['expectedReturnDate'];
$checkoutID = $row['checkoutRequests_id'];
$checkoutDate = $row['checkoutRequestDate'];
$users_arr[] = array("id" => $checkoutID, "requestDate" => $checkoutDate, "returnDate" => $returnDate);
}
echo json_encode($users_arr);