“IS_Unique in Codesigniter -Formalvalidierung” Code-Antworten

IS_Unique in Codesigniter -Formalvalidierung

$this->form_validation->set_rules('order_no', 'Order no', 'required|callback_check_order_no');
Wicked Wombat

IS_Unique in Codesigniter -Formalvalidierung

function check_unique_order_no($id = '', $order_no) {
        $this->db->where('order_no', $order_no);
        $this->db->where('status', "A");

        if($id) {
            $this->db->where_not_in('id', $id);
        }
        return $this->db->get('delivery_order')->num_rows();
    }
Wicked Wombat

IS_Unique in Codesigniter -Formalvalidierung

function check_order_no($order_no) {        
        if($this->input->post('id'))
            $id = $this->input->post('id');
        else
            $id = '';
        $result = $this->Data_model->check_unique_order_no($id, $order_no);
        if($result == 0)
            $response = true;
        else {
            $this->form_validation->set_message('check_order_no', 'Order no already exist');
            $response = false;
        }
        return $response;
    }
Wicked Wombat

Ähnliche Antworten wie “IS_Unique in Codesigniter -Formalvalidierung”

Fragen ähnlich wie “IS_Unique in Codesigniter -Formalvalidierung”

Weitere verwandte Antworten zu “IS_Unique in Codesigniter -Formalvalidierung” auf PHP

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen