query("SELECT contacts.*, clients.name as client_name FROM contacts JOIN clients ON contacts.client_id = clients.id ORDER BY contacts.name ASC"); $contacts = $stmt_contacts->fetchAll(PDO::FETCH_ASSOC); $stmt_clients = $pdo->query("SELECT id, name FROM clients ORDER BY name ASC"); $clients = $stmt_clients->fetchAll(PDO::FETCH_ASSOC); } catch (PDOException $e) { echo '
Error fetching data: ' . $e->getMessage() . '
'; $contacts = []; $clients = []; } ?>

Contacts

Name Email Phone Client Role Actions
No contacts found.