title: How to check if id already exists - codeigniter
body: <p>i am trying to check if an id in the database already exists and if it does not then only insert that id and not the other ones that exist</p>
  
  <p>I have tried to do a where statement that checks if their is a id exists in the database but even if their are new information it does not insert it into the database</p>
  
  <p>Im quite lost here
  any guidance would be appreciated</p>
  
  <p>ps i dont want to update a row i want to insert a new updated one that does not exist</p>
  
  <pre><code>$this-&gt;db-&gt;where('id',$id);
  $q = $this-&gt;db-&gt;get('testing');
  
  if($q)
  {
      //Do nothing
  }
  else
  {
  
      $this-&gt;db-&gt;set('id', $id);
      $this-&gt;db-&gt;set('message', $message);
      $query= $this-&gt;db-&gt;insert('testing');
  
  }
  </code></pre>