Welcome Guest, Not a member yet? Register   Sign In
Increment a field in the query builder
#1

Hi !

Actually I'm working of the completion of a data interval system and with the query buider it's impossible to do something like that :

PHP Code:
$this->db->update($table, ['f_right' => 'f_right + 1'], ['f_id' => $id]); 

We need to do :

PHP Code:
$sql "UPDATE " $table " SET f_right = f_right + 1 WHERE f_id = " $this->db->escape($id); 

Do you think it will be useful to implement a condition to specify the new value is an incremented field ? Smile

PS : excuse my english french Blush
Reply
#2

Write this

PHP Code:
$this->db->set('f_right''f_right+1'false);
$this->db->where('f_id'$id);
$this->db->update($table); 

Reply
#3

Oh my bad. I note. Thanks
Reply




Theme © iAndrew 2016 - Forum software by © MyBB