[eluser]JoostV[/eluser]
Hi,
I use active record for updating data. Works like a breeze, except when two fields in my set() array have the same value. In that case only the first of the two fields is updated. Can anybody help me out here? Am I doing something utterly stupid?
Code example failure
The field 'cat_active' will NOT be updated, because it has the same value as 'cat_catset_id'
Code:
$array = array('cat_catset_id' => '1','cat_title' => 'News','cat_active' => '1');
$this->db->set($array);
Above code will produce this query:
UPDATE `pa_categories` SET `cat_catset_id` = '1', `cat_title` = 'News' WHERE `cat_id` = 1
Code example success
However, if I appoint different data to 'cat_active' and 'cat_catset_id', both fields are updated just fine!
Code:
$array = array('cat_catset_id' => '1','cat_title' => 'News','cat_active' => '0');
$this->db->set($array);
Above code will produce this query:
UPDATE `pa_categories` SET `cat_catset_id` = '1', `cat_title` = 'News', `cat_active` = '0' WHERE `cat_id` = 1
It is driving me crazy! Can anybody explain what is happening here?