function write($sess_id, $sess_data) { if (!$sess_id || !$sess_data) { return false; } $data = array('sess_time' => time(), 'sess_data' => $sess_data); // update $where = 'sess_id = ' . $this->db->quote($sess_id) . ' AND sess_name = ' . $this->db->quote($this->sess_name()); if ($this->db->update('c_session', $data, $where) && $this->db->affectedRows()) { return true; } // insert $data['sess_id'] = $sess_id; $data['sess_name'] = $this->sess_name(); return (bool) $this->db->insert('c_session', $data); }