-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdelete_report.php
103 lines (90 loc) · 3.26 KB
/
delete_report.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
<?php
require('connection.php');
$sql = "SELECT * FROM REPORT";
if(isset($_GET['id']))
{
$getid = $_GET['id'];
$sql1 = "DELETE FROM REPORT WHERE Date Report_id = $getid ";
if( $conn->query($sql1))
{
echo"<script>
setTimeout(function(){window.location='http://localhost/lmms/delete_report.php';},2000)
</script>";
}
}
$query = $conn->query($sql);
$row = $query->fetch_assoc();
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap demo</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body>
<div class ="container">
<div class ="row">
<div class ="col">
</div>
<div class ="col">
<h3>Report List</h3>
<table class="table">
<thead>
<tr>
<th scope="col">Report Id</th>
<th scope="col">Room No</th>
<th scope="col">Device Id</th>
<th scope="col">Description</th>
<th scope="col">Date</th>
<th scope="col">Time</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
while($row = $query->fetch_assoc()){
?>
<tr>
<td><?php echo $row['Report_id'];?></td>
<td><?php echo $row['Room'];?></td>
<td><?php echo $row['Device_id'];?></td>
<td><?php echo $row['Description'];?></td>
<td><?php echo $row['Date'];?></td>
<td><?php echo $row['Time'];?></td>
<td><!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal<?php echo $row['Report_id'];?>">
Delete
</button>
<!-- Modal -->
<div class="modal fade" id="exampleModal<?php echo $row['Report_id'];?>" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h1 class="modal-title fs-5" id="exampleModalLabel">Delete Report</h1>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
First Resolve Then delete
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
<a href ="delete_report.php?id=<?php echo $row['Report_id'];?>" ><button type="button" class="btn btn-primary">Delete</button></a>
</div>
</div>
</div>
</div>
</td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class ="col">
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>