public function getContactById() { $person = new PersonPDO(); $this->nameDOB = $person->readById($this->personId); $address = new AddressPDO(); $this->address = $address->readAllByPersonId($this->personId); $phoneNumber = new PhoneNumberPDO(); $this->phoneNumber = $phoneNumber->readAllByPersonId($this->personId); $emailAddress = new EmailAddressPDO(); $this->emailAddress = $emailAddress->readAllByPersonId($this->personId); $image = new ImagePDO(); $this->avatar = $image->getAvatarImageByPersonId($this->personId); $this->image = $image->readAllByPersonId($this->personId); }
<?php require "controllers/LoginController.php"; require "models/Contact.php"; ob_start(); require "phoneEmailAddress.php"; $phoneEmailAddress = ob_get_contents(); ob_end_clean(); require "controllers/PersonController.php"; $updateForm = null; // http://localhost/contact_v1.1/newcontact.php?id=1&action=update if (isset($_GET['action']) && $_GET['action'] === 'update') { $action = "update"; $id = (int) $_GET['id']; $contact = new PersonPDO(); $updateForm = $contact->readById($id); } else { $action = "create"; } $error = NULL; if (isset($_GET['validate']) && $_GET['validate'] == "error") { $error = 1; } ?> <?php $id = NULL; if (isset($_GET['id'])) { $id = $_GET['id']; } if (isset($_POST['id'])) {