[eluser]draconus[/eluser]
I created this form a while ago, and it worked well for quite a while, but somewhere along the way i broke it, and i can't figure out what the issue is.
Here is my model for this:
Code:
function update(){
$form = array(
'id' => $this->input->post('id'),
'firstName' => $this->input->post('firstName'),
'lastName' => $this->input->post('lastName'),
'address' => $this->input->post('address'),
'address2' => $this->input->post('address2'),
'city' => $this->input->post('city'),
'state' => $this->input->post('state'),
'country' => $this->input->post('country'),
'postal' => $this->input->post('postal'),
'home' => $this->input->post('home'),
'business' => $this->input->post('business'),
'cell' => $this->input->post('cell'),
'email' => $this->input->post('email'),
'activated' => $this->input->post('activated'),
'practitioner' => $this->input->post('practitioner'),
'administrator' => $this->input->post('administrator'),
'profile' => $this->input->post('profile')
);
$this->db->where('id', $form['id']);
$this->db->update('users', $form);
$sql = ("SELECT * FROM users where id = '$form[id]' and activated = 1");
$query = $this->db->query($sql);
return ($query->num_rows() > 0) ? $query->row_array() : FALSE;
}
and here is my controller code:
Code:
function update(){
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="error">', '</div>');
$data['title'] = ".:Conta Administração:.";
$id = $this->session->userdata('id');
if (!$this->session->userdata('activated')){
$data['error'] = "1";
$data['message'] = "Acesso negado, acesse a continuar...";
$data['body'] = "";
$this->load->view('index', $data);
}else{
if ($this->form_validation->run() == FALSE){
$this->load->model('user');
$query = $this->user->get($id);
$this->load->view('member/update', $query);
}else{
$this->load->model('user');
$data = $this->user->update();
$this->session->set_userdata($data);
$data['notice'] = "1";
$data['message'] = "Seu perfil foi atualizado...";
$this->load->view('member/profile', $data);
}
}
}
The profile page of course pulls the information from the session.
The error messages I am getting aren't very helpful, as they don't point to the issue within my code, but rather the builtin session library:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: libraries/Session.php
Line Number: 457
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /Users/draconus/Sites/brazil/system/libraries/Exceptions.php:164)
Filename: libraries/Session.php
Line Number: 662
Any help would be greatly appreciated.