public function getRealmById($id) { $this->db->select('id, flag')->from('realmlist')->where("id", $id); $query = $this->db->get(); if ($query->rowCount() > 0) { $row = $this->db->fetch($query); $realm = new Realm($row->id); $realm->setOnline(!($row->flag & 0x2)); return $realm; } else { return NULL; } }