Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] set_flashdata in Model?
#4

[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. Sad

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;
        }
    }


Messages In This Thread
[SOLVED] set_flashdata in Model? - by El Forum - 01-23-2008, 06:34 AM
[SOLVED] set_flashdata in Model? - by El Forum - 01-23-2008, 07:43 AM
[SOLVED] set_flashdata in Model? - by El Forum - 01-23-2008, 07:59 AM
[SOLVED] set_flashdata in Model? - by El Forum - 01-23-2008, 09:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB