-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtickets.php
56 lines (52 loc) · 1.99 KB
/
tickets.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Tickets</title>
<link rel="stylesheet" href="styles/tickets.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"/>
</head>
<body>
<div class="container">
<h2>My Tickets</h2>
<button id="add-new"><i class="fa-solid fa-plus"></i><a href="contact.php"> New Ticket</a></button>
<table id="customers">
<tr>
<th>ID</th>
<th>Date/Time</th>
<th>Message</th>
<th>Actions</th>
</tr>
<?php
ini_set('display_errors', 0);
error_reporting(E_ERROR | E_WARNING | E_PARSE);
session_start();
include_once "config.php";
// Get the user's email from the session
$userid = $_SESSION['user_id'];
// Fetch the tickets submitted by the corresponding user
$sql = "SELECT * FROM tickets WHERE user_id = '$userid'";
$result = $conn->query($sql);
if (!$result) {
die("Invalid query!");
}
while ($row = $result->fetch_assoc()) {
echo "
<tr>
<td>$row[ticket_id]</td>
<td>$row[timestamp]</td>
<td class='message' title='$row[message]'>$row[message]</td>
<td>
<a class='btn btn-success' href='editTicket.php?ticket_id=$row[ticket_id]'>Edit</a>
<a class='btn btn-danger' href='deleteTicket.php?ticket_id=$row[ticket_id]'>Delete</a>
</td>
</tr>
";
}
?>
</table>
</div>
</body>
</html>