prepare("SELECT client_code FROM clients WHERE id = ?"); $stmt->execute([$delete_id]); $client_code = $stmt->fetchColumn(); $stmt = $pdo->prepare("DELETE FROM clients WHERE id = ?"); $stmt->execute([$delete_id]); logActivity($_SESSION['admin_id'], 'delete_client', "Deleted client: $client_code", 'client', $delete_id); $success = 'Client deleted successfully!'; } catch (Exception $e) { $error = 'Error deleting client.'; } } } // Fetch clients try { $pdo = getDBConnection(); $stmt = $pdo->query("SELECT * FROM clients ORDER BY created_at DESC"); $clients = $stmt->fetchAll(); } catch (Exception $e) { $clients = []; } $total_clients = count($clients); $active_clients = count(array_filter($clients, fn($c) => $c['status'] === 'active')); $total_projects = array_sum(array_column($clients, 'total_projects')); $total_revenue = array_sum(array_column($clients, 'total_revenue')); include 'includes/header.php'; ?>
Manage client accounts and projects
| ID | Client Code | Company Name | Industry | Contact Person | Location | Email & Phone | Projects | Revenue | Status | Actions |
|---|---|---|---|---|---|---|---|---|---|---|
| No clients found. Click "Add New Client" to create one. | ||||||||||
| # |
|
₹ | ||||||||