title: Codeigniter Callback prevent adding duplicate firstname and lastname
body: <p>I need help on how to check if firstname and lastname already exists in the database and then call a callback using codeiginiter. I'm totally stuck right now.
  Firstname and Lastname are two different fields by the way. Thanks</p>
  
  <pre><code>public function check_duplicate($str,$col) 
          {
              $res = $this-&gt;db-&gt;get_where("patients",array(
                  'firstname' =&gt; 'Firstname',
                  'lastname' =&gt; 'Lastname'
                  ));
              if($res-&gt;num_rows()){
                   $this-&gt;form_validation-&gt;set_message('check_duplicate', 'The %s field already exists.');
                   return false;
              }  else {
                   return true;
              }
          }
  </code></pre>