connect_error) { die("Connection failed: " . $conn->connect_error); } // Pagination settings from localStorage or defaults $page = isset($_GET['page']) ? (int)$_GET['page'] : 1; $limit = isset($_COOKIE['ticketsPerPage']) ? (int)$_COOKIE['ticketsPerPage'] : 15; $defaultSortColumn = isset($_COOKIE['defaultSortColumn']) ? $_COOKIE['defaultSortColumn'] : 'ticket_id'; $sortDirection = isset($_COOKIE['sortDirection']) ? $_COOKIE['sortDirection'] : 'desc'; $offset = ($page - 1) * $limit; // Get total number of tickets based on current filter $status = isset($_GET['status']) ? $_GET['status'] : 'Open'; $statuses = explode(',', $status); $whereClause = ""; if (isset($_GET['status']) && !empty($_GET['status'])) { $statuses = explode(',', $_GET['status']); $whereClause = "WHERE status IN ('" . implode("','", $statuses) . "')"; } $totalTicketsQuery = "SELECT COUNT(*) as total FROM tickets $whereClause"; $totalTicketsResult = $conn->query($totalTicketsQuery); $totalTickets = $totalTicketsResult->fetch_assoc()['total']; $totalPages = ceil($totalTickets / $limit); // Modify SQL to use these settings and filter $sql = "SELECT * FROM tickets $whereClause ORDER BY $defaultSortColumn $sortDirection LIMIT $limit OFFSET $offset"; $result = $conn->query($sql); ?> Ticket Dashboard

Tinker Tickets

Total Tickets:
num_rows > 0) { while($row = $result->fetch_assoc()) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } } else { echo ""; } ?>
Ticket ID Priority Title Category Type Status Created Updated
{$row['ticket_id']}{$row['priority']}{$row['title']}{$row['category']}{$row['type']}{$row['status']}" . date('Y-m-d H:i', strtotime($row['created_at'])) . "" . date('Y-m-d H:i', strtotime($row['updated_at'])) . "
No tickets found
close(); ?>