public function get_by_id($id) { $this->db->connect(); $sql = "SELECT * FROM teachers WHERE id=?"; $stmt = $this->db->initialize($sql); $stmt->bind_param("i", $id); $stmt->execute(); $stmt->bind_result($id, $first_name, $last_name, $email, $contact_no, $faculty); $teacher = new Teachers(); while ($row = $stmt->fetch()) { $teacher->set_id($id); $teacher->set_first_name($first_name); $teacher->set_last_name($last_name); $teacher->set_email($email); $teacher->set_contact_no($contact_no); $teacher->set_faculty($faculty); } return $teacher; }