Validation UNIQUE field in Codeigniter with 2 index

前端 未结 4 526
不思量自难忘°
不思量自难忘° 2021-01-18 08:07

In the Codeigniter Framework, I can validate an Unique field in the MYSQL Database using the \"Form Validation Class\". Exemple:

$this->form_validation-&         


        
4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-18 08:42

    $this->form_validation->set_rules(
        'form_field', 
        'form_label', 
        'trima|is_unique[table1.field1],trim|required|is_unique[table.field2]');
    

    use

    'trima|is_unique[table1.field1],trim|required|is_unique[table.field2]' 
    

    in single code

提交回复
热议问题