[eluser]CroNiX[/eluser]
Why not just:
Code:
$this->db->select('user.id, userOptions.available')
$this->db->join('userOptions', 'user.id = userOptions.userId', 'left outer');
$this->db->where('user.code', $code);
$this->db->get('user');
$user_data = $this->db->row_array();
//this query will have nothing to do with the last query, because the last query has already been executed.
//So all "wheres", "joins" etc, are reset now.
$data = array('name' => $name);
$this->db->where('id', $user_data['id']);
$this->db->update('user', $data);
However, if you check at the bottom of the Generating Query Results page in the manual, you will see you can also do:
$user_data->free_result();
which will actually close that db resource connection and reset everything, freeing up memory. But it is mostly unnecessary unless dealing with massive data.