title: Verify if the user already exists Codeigniter
body: <p>I already have a code to check if the user email is already registered, but now I need check another values in MySQL.</p>
  
  <p>In my code have an Input with name 'cpfcnpj'  and need to consult it in 2 columns (cpf and cnpj), but it's nothing returning the error, as happen with email.</p>
  
  <p>My code</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>if($this-&gt;input-&gt;post("cpfcnpj")){
      $this-&gt;session-&gt;set_userdata(array("cpfcnpj" =&gt; $this-&gt;input-&gt;post("cpfcnpj")));
      $ret = $this-&gt;cliente_model-&gt;verificaCpfcnpj($this-&gt;session-&gt;userdata("cpfcnpj"));
      if($ret){
          $this-&gt;session-&gt;set_flashdata('error', 'This CPF/CNPJ already exist!&lt;/a&gt; :)');
          redirect($_SERVER['HTTP_REFERER']);
          die();
      }
  }
  </code></pre>
  
  <p><strong>Model</strong></p>
  
  <pre><code>public function verificaCpfcnpj($cpfcnpj){
      $this-&gt;db-&gt;select("cpf,cnpj");
      $this-&gt;db-&gt;where('cpf',$cpfcnpj);
      $this-&gt;db-&gt;where('cnpj',$cpfcnpj);
      $this-&gt;db-&gt;where('status',0);
  
      if($this-&gt;session-&gt;userdata('usu_id')){
          $this-&gt;db-&gt;where('id &lt;&gt; '.$this-&gt;session-&gt;userdata('usu_id'));
      }
      $query = $this-&gt;db-&gt;get('ga845_clientes');
      if ($query-&gt;num_rows() &gt; 0){
          $row = $query-&gt;row(); 
  
          return $row-&gt;cpf;
          return $row-&gt;cnpj;
      }else{
          return "";
      }
  }
  </code></pre>
  
  <p><strong>View</strong></p>
  
  <pre><code>    &lt;form action="cliente/novoCadastro" method="post" class="clearfix form form-cadastro"&gt;
          &lt;input type="hidden" name="tipo" id="tipoPessoa"  value="f"&gt;
          &lt;div class="campo"&gt;
              &lt;label class="lbl" for=""&gt;CPF/CNPJ&lt;/label&gt;
              &lt;input type="text" class="input-text text cpfcnpj required" name="cpfcnpj" id="cpfcnpj"&gt;
          &lt;/div&gt;
          &lt;br&gt;
          &lt;input type="submit" value="Continuar" class="btn"&gt;
      &lt;/form&gt; 
  </code></pre>