我想通过id更新特定的用户记录并在codeigniter中填写更新表单时进行验证

时间:2019-01-07 18:02:13

标签: php html5 codeigniter-3

此代码用于通过表单验证来更新具有特定ID的记录,但是表单验证无法正常工作。我收到以下错误:

  

致命错误:在198行的D:\ xampp \ htdocs \ CodeIgniter-3.1.9 \ admin \ system \ core \ Output.php中,已用完的内存大小为134217728字节(试图分配65019592字节)

public function customer_updatedata($id)
{
    $this->load->view("customer_updatedatatable");
    $row=$this->Customer_datatable->get_by_id($id);
    //print_r($row);

    $this->form_validation->set_rules('fname','First name','required');
    $this->form_validation->set_rules('lname','Last name','required');
    $this->form_validation->set_rules('email','Email','required');
    $this->form_validation->set_rules('mobile','Mobile','required');
    $this->form_validation->set_rules('password','Password','required');
    $this->form_validation->set_rules('gender','Gender','required');
    $this->form_validation->set_rules('profession','Profession','required');
    $this->form_validation->set_rules('flatno','Flat no','required');
    $this->form_validation->set_rules('buildingname','Building name','required');
    $this->form_validation->set_rules('street','Street','required');
    $this->form_validation->set_rules('closetlandmark','Closet landmark','required');
    $this->form_validation->set_rules('city','City','required');
    $this->form_validation->set_rules('state','State','required');
    $this->form_validation->set_rules('zipcode','Zipcode','required');

    if ($this->form_validation->run()) 
    {   
        $fname=$this->input->post('fname');
        $lname=$this->input->post('lname');
        $email=$this->input->post('email');
        $mobile=$this->input->post('mobile');
        $password=$this->input->post('password');
        $gender=$this->input->post('gender');
        $profession=$this->input->post('profession');
        $flatno=$this->input->post('flatno');
        $buildingname=$this->input->post('buildingname');
        $street=$this->input->post('street');
        $closetlandmark=$this->input->post('closetlandmark');
        $city=$this->input->post('city');
        $state=$this->input->post('state');
        $zipcode=$this->input->post('zipcode');

        $r = $this->Customer_datatable->update($id,$fname,$lname,$email,$mobile,$password,$gender,$profession,$flatno,$buildingname,$street,$closetlandmark,$city,$state,$zipcode);

        $this->session->set_flashdata('success', 'Record Updated Successfully'); 
        redirect(site_url('Admin_Controller/customer_datatable')); 
    }
    else
    {   
        $this->session->set_flashdata('danger','Please fill all the details');
        $this->customer_updatedata($id);
        //echo validation_errors();
    }  
}

0 个答案:

没有答案