I want to add 1 to my column named SIZE
(integer), this is my query:
$this->dbsections->update('sections', "SIZE = SIZE + 1");
But in the error message, it reads as:
UPDATE `sections` SET `SIZE = SIZE +` 1 = '' WHERE `NAME` = 'ABC'
I want to add 1 to my column named SIZE
(integer), this is my query:
$this->dbsections->update('sections', "SIZE = SIZE + 1");
But in the error message, it reads as:
UPDATE `sections` SET `SIZE = SIZE +` 1 = '' WHERE `NAME` = 'ABC'
You can rewrite your update query
$this->dbsections->set('SIZE', 'SIZE+1', FALSE);// third parameter FALSE
$this->dbsections->where('NAME', "ABC");
$this->dbsections->update('sections');
set() will also accept an optional third parameter ($escape), that will prevent data from being escaped if set to FALSE
Read https://www.codeigniter.com/userguide3/database/query_builder.html#updating-data