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

[eluser]il_dandi[/eluser]
Code:
class Avatars extends Controller {
    
    function Avatars()
    {
        parent::Controller();
        
        $this->load->model('admin/avatars_model');
        $this->load->model('admin/Login_model');
            
        $this->load->helper("form");
        $this->load->helper("url");
        $this->load->library('validation');    
        
        $this->template->write('title', 'Gestione personaggi');
        $this->template->write_view('sidebar', 'common/sidebar');
        $this->template->write_view('header', 'common/header');
        $this->template->write_view('footer', 'common/footer');        
    }
        
    
    
    function index()
    {
        $this->autentica();    
        $idUtente=$this->Login_model->idUtente();
        $data['avatars']=$this->avatars_model->avatars($idUtente);
        $this->template->write_view('content', 'admin/avatars', $data, TRUE);
          $this->template->render();
        
    }
    
    function add()
    {
        $this->template->write('title', 'NEW');
        
        $this->load->helper('form'); //New
        
        
        $data['bbb']=$this->db->get('bbb');
        $data['aaa']=$this->db->get('aaa');
        $data['ccc']=$this->db->get('ccc');

        
        //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");
        }
        
    }
    


    
    function _validate_form()
    {
        /*
        $rules = array(
                'category'        =>    'trim|required|numeric',
                'title'            =>    'trim|required|strip_tags|xss_clean|max_length[30]',
                'description'    =>    'trim|strip_tags|xss_clean|max_length[500]',
                'url'            =>    'trim|required|xss_clean|prep_url|max_length[80]'
        );
        $this->validation->set_rules($rules);
        
        $fields = array(
                'category'        =>    'Category',
                'title'            =>    'Title',
                'description'    =>    'Description',
                'url'            =>    'URL'
        );
        $this->validation->set_fields($fields);
        
        return ($this->validation->run() == FALSE) ? FALSE : TRUE;
        
        */
        
        return TRUE;
    }    
    
}
?>


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



Theme © iAndrew 2016 - Forum software by © MyBB