[eluser]David Rothera[/eluser]
If I change it from flashdata to userdata it still can't do it, for some reason I cant set session data of any kind from within the model.
EDIT: The code from the model, by messing with different debugging I have found that if I set the flash/userdata inside the model and then echo it out in the model as well it is fine however you cannot access any session data from outside the model.
EDIT2: I have solved it, I replaced the redirect with a plain anchor and it works now.
Code:
function addUser($data)
{
$query = $this->db->query("SELECT `id` FROM (`users`) WHERE `email_address` = '$data[email_address]'");
if ($query->num_rows > 0) {
$this->session->set_flashdata('message', 'Error: The email address is already active in the system!');
return 0;
}
if ($this->db->insert('users', $data)) {
$this->session->set_flashdata('message', 'Notice: User added successfully.') or die('waa waa2');
return 1;
} else {
$this->session->set_flashdata('message', 'Error: There was an error adding the user, please try again.') or die('waa waa3');
return 0;
}
}