codeigniter中的错误1146

时间:2014-02-10 07:39:18

标签: php codeigniter

我正在尝试将数据插入到名为'user'的表中,但我收到此错误。我已正确设置数据库。

  

发生数据库错误

     

错误号码:1146

     

表'folwd.users'不存在

SELECT * FROM (`users`) WHERE `username` = 'Pallavi123' LIMIT 1
  

文件名:C:\ wamp \ www \ PhpProject1 \ system \ database \ DB_driver.php

     

行号:330

名为users的表根本不存在。

user_manager_controller:

public function register(){
        if($this->session->userdata('logged_in')){
            //user is already logged in
            redirect('profile');
            }else{
            //init
            //$data['country_list']=$this->config->item('um_country_list');
            $data['username']='';

            $data['firstname']='';
            //$data['secondname']='';
            $data['lastname']='';
                        $data['email']='';
            //$data['dateofbirth']='';
            //$data['default_country']=$this->config->item('um_default_country');
            //load rules
            $rules=$this->config->item('um_register_rules');
            //default msg
            $data['msg']=$this->lang->line('um_form_msg');

            if(isset($_POST['submit'])){
                //the user has submitted the form
                //get the user input
                $data['username']=$this->input->post('username');

                $data['firstname']=$this->input->post('firstname');
                //$data['secondname']=$this->input->post('secondname');
                $data['lastname']=$this->input->post('lastname');
                                $data['email']=$this->input->post('email');
                //$data['dateofbirth']=$this->input->post('dateofbirth');
                //$data['default_country']=$this->input->post('country');

                $this->form_validation->set_rules($rules);//check with the rules
                if ($this->form_validation->run() === FALSE){
                    //validation failed
                    $data['msg']=$this->lang->line('um_form_error');
                    $this->load->view('user_register_form',$data);
                }else{
                    //validation passed
                    $dbdata=array(
                        'username'=>$this->input->post('username'),

                        'firstname'=>$this->input->post('firstname'),
                        //'secondname'=>$this->input->post('secondname'),
                        'lastname'=>$this->input->post('lastname'),
                                            'email'=>$this->input->post('email'),
                                                'password'=>$this->input->post('password'),
                        //'dateofbirth'=>$this->input->post('dateofbith'),
                        //'country'=>$this->input->post('country')
                    );

                    $this->user_manager->register_user($dbdata);

                    $data['msg']=$this->lang->line('um_form_activate');

                    //render the view
                    $this->load->view('um_msg',$data);
                }
            }else{
                //render the view
                $this->load->view('user_register_form',$data);
            }
        }
    }

um_users_model

function register_user($dbdata){
    $this->db->insert('user', $dbdata);
    $this->db->last_query();
}

0 个答案:

没有答案