[eluser]sk.avenger[/eluser]
I have the problem in CI with updating table ...
Give an example
table structure "example":
Code:
+----+-------+
| id | title |
+----+-------+
| 1 | test |
+----+-------+
model ex_model:
Code:
public function save($id,$title)
{
$this->db->set('title', $title)->where('id', $id)->update('example');
return $this->db->affected_rows() > 0;
}
controller ex_controller:
Code:
public function edite()
{
$this->load->model('ex_model');
if( ! $this->ex_model->save(1,'test'))
show_error('affected rows return 0.');
}
During the execution of the method edite(), our controller, the method save(), models ex_model, returns 0, in consequence of that, we will see on the screen error page show_error().
Why, when in the update() is transmitted exactly the same values as at the moment are in the table, affected_rows() returns 0 instead of 1??
And how to be in this situation?