如何验证类型是否存在?

时间:2019-01-31 06:00:41

标签: php validation

我的桌子: enter image description here

在此表中,我具有“类型”字段,在编辑值时,我已验证表中是否存在该类型。并且我已验证“ TAcNo”是否存在。

我的问题是验证不适用于类型字段。因为在此期间,如果我将值TAcNo输入为“ 8”,但在此期间没有类型“ O”,则显示消息不存在,仅是错误来了。

    public function Open_Payment_Edit(){
        $session_data = $this->session->userdata('logged_in');
        $data['username'] = $session_data['username'];
$query = $this->db->get('parmaster');    

        $data['PName']=$query->result_array();

    $data['query']=$this->User_model->viewAccMaster();
        $data['query1']=$this->User_model->viewAccMaster1();

$this->load->library('form_validation');

$this->form_validation->set_rules('Code', 'TAcNo', 'required|is_unique[tipup_payment.TAcNo]');
$this->form_validation->set_rules('type', 'type', 'required[tipup_payment.type]');      



         if ($this->form_validation->run() == FALSE) {

                    $data['r'] = $this->User_model->getTipUpPay();
                    $data['q'] = $this->User_model->Repay_Schedule();
                    $data['result'] = $this->User_model->Payment_Mode();
                    $data['s'] = $this->User_model->Tieup_Details();
                    $this->load->view('TipUp_Loan/Open_Payment_Edit',$data);
                }
                else
                {
            $this->session->set_flashdata('Add', 'The AcNo is not in the database');
                redirect("TipUp_Loan","refresh");   
                }


    }

0 个答案:

没有答案