<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class MY_Form_validation extends CI_Form_validation { function __construct(){ parent::__construct(); } function error_array(){ return $this->_error_array; } public function is_unique($str, $field) { $field_ar = explode('.', $field); $query = $this->CI->db->get_where($field_ar[0], array($field_ar[1] => $str), 1, 0); if ($query->num_rows() === 0) { return TRUE; } return FALSE; } function unique_check($str, $field) { list($field,$exclude)=explode(',', $field); list($table, $field) = explode('.', $field); if(!empty($exclude)) { list($field_name, $post_field) = explode('.', $exclude); $value= $this->CI->input->post($post_field); $this->CI->db->where_not_in($field_name,$value); }