views:

236

answers:

2

I have something like this:

$this->db->set('val', 'val+1', FALSE);
$this->db->where('id', $id);
$query = $this->db->update(TABLE_NAME);

How can I then go and get the new value of 'val'? Do I have to do another select or can I get it off of $query?

+2  A: 

I've some experience with CodeIgniter and as far as I know you have to requery again. The update only returns the number of rows affected.

Alex
A: 

the update query doesnt return anything. if you want to get the value of $val you'll have to run another query

you could run it before running this one, pass the value of val as a parameter to your query next to $id and then return that value + 1.

stef