Welcome Guest, Not a member yet? Register   Sign In
A Database Error Occurred You must use the "set" method to update an entry.
#5

[eluser]il_dandi[/eluser]
I've tried you solution

Model
Code:
function add_entry()
    {        
        $fields = array(
            'idUser'            =>    '1',
            'idCountry'            =>    $this->input->post('idCountry'),
            'aaa'                =>    $this->input->post('aaa'),
            'bbb'                =>    $this->input->post('bbb'),
            'firstname'            =>    $this->input->post('firstname'),
            'lastname'            =>    $this->input->post('lastname'),
            'age'                =>    $this->input->post('age')
        );
        
        
        $this->db->set($fields);
        $this->db->insert('avatars');
        $id = $this->db->insert_id();
        return $id;
            
        
    }

When I select add

http://localhost:8080/app/avatars/add

Code:
function add()
    {
        $this->template->write('title', 'asdsadas');
        
        $this->load->helper('form');
        
        $data['aaa']=$this->db->get('aaa');
        $data['bbb']=$this->db->get('bbb');
        $data['countries']=$this->db->get('countries');
        
        //New
        if ( ! $this->_validate_form() )
        {
            $this->template->write_view('content', 'admin/avatars', $data, TRUE);
        }
        else
        {
            $id = $this->avatars_model->add_entry();
$this->session->set_flashdata('msg', 'OK');
            redirect(base_url()."admin/avatars");
        }
                
    }

I see the flash message (OK) ...without see the insert area (my avatar.php view). Where is it my error?? I have to run the view for insert new record I think... but where?


Thanks


Messages In This Thread
A Database Error Occurred You must use the "set" method to update an entry. - by El Forum - 03-15-2009, 08:31 AM



Theme © iAndrew 2016 - Forum software by © MyBB