/** * @param int $address - IP address of a machine in the required lab * @return Lab - Lab object for specified IP address or false if not found */ public function get_lab_based_on_client($address) { $sql = 'SELECT lab, name FROM client_identifiers, labs WHERE client_identifiers.lab = labs.id AND address = ?'; $lab_results = $this->db->prepare($sql); $lab_results->bind_param('s', $address); $lab_results->execute(); $lab_results->store_result(); $lab_results->bind_result($lab_id, $room_name); if ($lab_results->num_rows < 1) { $lab_results->close(); return false; } $lab_results->fetch(); $lab_object = new Lab(); $lab_object->set_id($lab_id); $lab_object->set_name($room_name); $lab_results->close(); return $lab_object; }