title: is_unique in codeigniter for edit function
body: <p>i have requirement , where i m able to do validation for unique value in new add function like</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('email','Email','required|valid_email||is_unique[users.Email]');
  </code></pre>
  
  <p>its working but in edit function its not working..i have written callback function to check unique email.
  this is code i have written in edit function</p>
  
  <pre><code>$this-&gt;form_validation-&gt;set_rules('email','Email','required|valid_email|callback_check_email');
  
  function check_username($email)
      { 
          $return_value = $this-&gt;user_model-&gt;check_email($email);
          if ($return_value)
          {
              $this-&gt;form_validation-&gt;set_message('email_check', 'Sorry, This username is already used by another user please select another one');
              return FALSE;
          }
          else
          {
          return TRUE;
          }
      }
  </code></pre>
  
  <p>and user_model</p>
  
  <pre><code>function check_mail($email)
      { 
          $sql = "SELECT users.Email
                  FROM users
                  WHERE 
                  $email = users.Email
                  ";
  
          $result = $this-&gt;db-&gt;query($sql)-&gt;result_array();
          return $result;
  
      }
  </code></pre>
  
  <p>i m not able to validate the unique email</p>