title: Update only one record with Code Igniter
body: <p>Firstly, I will show what I want to do.</p>
  
  <p>I want check if user has more than one record:</p>
  
  <pre><code>WHERE 'from_user_id' == '$id'
  </code></pre>
  
  <p>When query <code>return &gt; 0</code>, I want update only ONE record <code>where 'from_user_id' == '$id'</code>,</p>
  
  <p>I dont care about order, It can be last or first record, but I have to update only one record.</p>
  
  <p>Here is part of my model:</p>
  
  <pre><code>public function get_bonuses() {
      if ($this-&gt;db-&gt;where('from_user_id', $this-&gt;user_id())-&gt;from($this-&gt;reff_table)-&gt;count_all_results()&gt;0 ) {
          $this-&gt;db-&gt;where('from_user_id', $this-&gt;user_id());
          $this-&gt;db-&gt;update($this-&gt;reff_table, array('used' =&gt; '1'));
          return true;
      } else
          return false;
  
  }
  </code></pre>
  
  <p>It works fine but I want update only one record :&lt;</p>
  
  <p>I hope anyone will help me.
  Regards</p>
  
  <p>----- EDIT
  SOLVED - I'm so stupid but I needed to look from the other side to my code :)
  Here is working code:</p>
  
  <pre><code>if ($this-&gt;db-&gt;where(array('from_user_id' =&gt;$this-&gt;user_id(), 'used' =&gt; '0' ))-&gt;from($this-&gt;reff_table)-&gt;count_all_results()&gt;0 ) { $this-&gt;db-&gt;where(array('from_user_id' =&gt;$this-&gt;user_id(), 'used' =&gt; '0' ))-&gt;limit(1); $this-&gt;db-&gt;update($this-&gt;reff_table, array('used' =&gt; '1')); return true;
  </code></pre>