db->get('users'); foreach ($query->result_array() as $row) { array_push($result, $row); } return $result; } function get_user($login) { $this->db->select('id, login, passwd'); $query = $this->db->get_where('users', array('login' => $login)); return ($query->num_rows() > 0) ? $query->row_array() : NULL; } function get_user_id($id) { $this->db->select('id, login, hash'); $query = $this->db->get_where('users', array('id' => $id)); return ($query->num_rows() > 0) ? $query->row_array() : NULL; } function add_user($login, $passwd) { $data = array( 'login' => $login, 'passwd' => $passwd, 'hash' => '' ); $this->db->insert('users', $data); } function del_user($id) { $this->db->delete('users', array('id' => $id)); } function update_user($id, $data) { $this->db->where('id', $id); $this->db->update('users', $data); } }