Welcome Guest, Not a member yet? Register   Sign In
Active Record : how to update the data
#1

[eluser]adwin[/eluser]
How to implement this query into CI activerecord

Code:
sql = "update myincome set expense=expense + 1000 where id = 1 "

I just don't know how to write
Code:
expense = expense + 1000


thnx Big Grin
#2

[eluser]Armchair Samurai[/eluser]
Probably:
Code:
$this->db->set('expense', 'expense + 1000', FALSE);
$this->db->where('id', 1);
$this->db->update('myincome');
#3

[eluser]Michael Wales[/eluser]
Code:
$this->db->set('expense', 'expense + 1000', FALSE);
$this->db->where('id', 1);
$this->db->update('myincome');
#4

[eluser]adwin[/eluser]
thanks ... that would be helpful Smile




Theme © iAndrew 2016 - Forum software by © MyBB