diff --git a/app/Controllers/Contacts.php b/app/Controllers/Contacts.php index 9bc53db..a01c709 100644 --- a/app/Controllers/Contacts.php +++ b/app/Controllers/Contacts.php @@ -21,7 +21,11 @@ class Contacts extends Controller { public function view($contactid = null) { $db = \Config\Database::connect(); - $sql = "SELECT * FROM contacts where contactid='$contactid'"; + $sql = "SELECT c.*, ct.cert_name, ct.file_url, ct.issued_date FROM contacts c + LEFT join certificates_training ctt on ctt.contact_id = c.contactid + LEFT join certificates ct on ct.cert_id = ctt.cert_id + WHERE contactid=$contactid + order by ct.issued_date DESC"; $query = $db->query($sql); $results = $query->getResultArray(); $data['contacts'] = $results; diff --git a/app/Views/contacts_index.php b/app/Views/contacts_index.php index 46680dc..bbf16f9 100644 --- a/app/Views/contacts_index.php +++ b/app/Views/contacts_index.php @@ -55,7 +55,7 @@