public function readOrder_byID($id) { $ordermodel = new Order_model(); $query = $this->db->get_where('orders', array('id' => $id)); if ($query->num_rows !== 1) { throw new Exception("ordermodel ID {$id} not found in database"); } $rows = $query->result(); $row = $rows[0]; $ordermodel->load($row); return $ordermodel; }