database - ZF Db Append to column -


im trying make update similar zend_db:

update `table` set   column = column + 'new value'   foo = 'bar' 

any of have done before? possible? thanks

with of zend_db_expr possible.

example:

$newvalue = 101; $data     = array('column' =>                   new zend_db_expr($db->quoteinto('column + ?', $newvalue))); $where    = $db->quoteinto('foo = ?', 'bar');  $updated = $db->update('table', $data, $where); 

resulting query:

update `table` set `column` = `column` + 101 `foo` = 'bar'; 

if asking how append string, code similar, cannot use + operator when dealing character data, instead use concat().

for example, change $data array this:

$data  = array('varcharcol' =>                new zend_db_expr(                    $db->quoteinto('concat(varcharcol, ?)', ' append more text!')          )); 

Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -