Welcome Guest, Not a member yet? Register   Sign In
how to
#1

[eluser]rafi_ccj[/eluser]
how can i update my table values by incrementing with the previous value using active record? i mean newValue=previousValue+newValue...is it possible?

update table set area = area+20 where id=2;

How can I do this with active record?
#2

[eluser]Aken[/eluser]
Use the set() function for that, and make sure to flag the third param as false so it does not auto-escape that part of the query. Adjust as needed.
Code:
$query = $this->db->set('column', 'column + 10', false)
->where('id', $id)
->update('table');
#3

[eluser]rafi_ccj[/eluser]
thanks!!! is it possible for insert?




Theme © iAndrew 2016 - Forum software by © MyBB