SQL update query in Zend Framework

entity-framework sql sql-update zend-framework

Question

How should I construct this SQL using the Zend Framework?

UPDATE register 
SET balance = (balance + 10) 
WHERE added_date > 1259944184 ;

Both the web and Zend's website lack any instances of this.

How should I utilize "Zend_Db_Expr "?

1
2
5/3/2012 10:33:28 AM

Accepted Answer

the documentation for the Zend Framework claims.

apply this

$data = array(
    'balance'      => 'balance + 10'
);

$n = $db->update('register ', $data, 'added_date > 1259944184');
1
12/4/2009 9:28:01 PM

Popular Answer

For me, this worked:

$data = array(balance => new Zend_DB_Expr('balance + 10'));

$db->update('register ', $data, 'added_date > 1259944184');


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow