title: Update specific row using codeigniter?
body: <p>I am trying to update specific row of table in codeigniter. But my code update all rows.</p>
  
  <p>Model:</p>
  
  <pre><code>function edit_profile($array){
          $email=$array['email'];
          $this-&gt;db-&gt;select("email");
          $this-&gt;db-&gt;from("user");
          $this-&gt;db-&gt;where('email', $email);
          $query=$this-&gt;db-&gt;get();
          if ($query-&gt;num_rows() == 1){
          $this-&gt;db-&gt;update('user',$array);
              return 1;
  
          }else{
              return $query-&gt;num_rows(); 
          }
      }
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>     public function edit()
          {
          $name = $this-&gt;input-&gt;post('user_name', TRUE);
          $email=trim($this-&gt;session-&gt;userdata('email'));
          $array = array('user_name'=&gt;$name,'email'=&gt;$email);
          $result = $this-&gt;edit_profile_model-&gt;edit_profile($array);
          echo $result;
          }
  </code></pre>
  
  <p>And in new page it show the echo value 1.
  How to update specific row? why <code>$query-&gt;num_rows()</code> return 1 and update all rows?</p>