title: How do I tell when a MySQL UPDATE was successful versus actually updated data?
body: <p>How do I tell when a MySQL UPDATE was successful versus actually updated data? </p>
  
  <p><strong>Example:</strong></p>
  
  <pre><code>TABLE
  id    city_name
  1     Union
  2     Marthasville
  </code></pre>
  
  <p>If I run the following:</p>
  
  <pre><code>$data = array('city_name', 'Marthasville');
  
  //update record 2 from Marthasville to the same thing, Marthasville. 
  $this-&gt;db-&gt;where('id', 2);
  $this-&gt;db-&gt;update('table', $data);
  
  if($this-&gt;db-&gt;affected_rows() &gt; 0)
  {
      //I need it to return TRUE when the MySQL was successful even if nothing was actually updated.
      return TRUE;
  }else{
      return FALSE;
  }
  </code></pre>
  
  <p>This will return <code>TRUE</code> every time the UPDATE statement is successful, but FALSE when no rows were actually updated.</p>
  
  <p>I need it to return <code>TRUE</code> every time the UPDATE statement was successfully executed even if it doesn't actually change any records. </p>