title: Codeigniter - update query executed successfully but $this->db->affected_rows() returns false
body: <p>I am working on a <code>Codeigniter</code> based web project where i need to update a user from admin panel. It works correctly if the updated value is different from the value already exists in database. The issue is that the <code>$this-&gt;db-&gt;affected_rows()</code> returns <code>TRUE</code> if the value is different but returns FALSE if the value is same.</p>
  
  <p>Here's my code:-</p>
  
  <pre><code>// $where contains the array for where clause
  // $data contains the array of user's data which includes the updated value
  
  $this-&gt;db
          -&gt;where($where)
          -&gt;update('users', $data);
  
  if($this-&gt;db-&gt;affected_rows() == true)
  {
      $response = array(
          'message' =&gt; "User edited successfully",
          'status' =&gt; true
      );
  }
  else
  {
      // this else block always get executed if the updated value is equal to the value already exists in database. But in reality the record was updated successfully
  
      $response = array(
          'message' =&gt; "Unable to edit user",
          'status' =&gt; false
      );
  }
  
  return $response;
  </code></pre>