Welcome Guest, Not a member yet? Register   Sign In
query builder class help

Hello everybody,

I have a little question about the query builder class.
Using normal sql I'd do this

PHP Code:
Update table set val val 3 where id 1

How can i do the same thing with the query class ? The code below doesn't work

PHP Code:
$this->db->set(array('val' => 'val+1'))->where(array('id' => 1))->update('table'); 
thank you for helping !

Disable auto escape may work:

PHP Code:
$this->db->set(array('val' => 'val+1'), ''FALSE)->where(array('id' => 1))->update('table');  

You could just set a variable.

$val = $val + 1;
$this->db->set(array('val' => $val))->where(array('id' => 1))->update('table');

That's right, with the third parameter i can do the update ! it's even on the manual..  Blush

But it doesn't work the query if i give as first parameter an array, second "blank" and third FALSE

The only way is to make value per value like this

PHP Code:

Theme © iAndrew 2016 - Forum software by © MyBB