Use Zend_Db_Expr new Zend_Db_Expr('nb_login+1')
Greetings Ramon On Thu, Oct 28, 2010 at 8:22 AM, debussy007 [via Zend Framework Community] < ml-node+3016954-326652987-72...@n4.nabble.com<ml-node%2b3016954-326652987-72...@n4.nabble.com> > wrote: > Hi, > > I want to increment a field "nb_login" whenever a member connects. > > These are the parameters that I give to update() method. > > $where = array('id = ?' => $id); > $data = array( > 'date_connection' => date('Y-m-d H:i:s'), > 'nb_login' => 'nb_login+1' > ); > > The query is generated is : > *UPDATE `patients_accounts` SET `date_connection` = '2010-10-28 12:21:31', > `nb_login` = 'nb_login+1' WHERE (id = 1)* > > This won't work because 'nb_login+1' is quoted. It would work if the > statement would be : > `nb_login` = nb_login+1 > > Thank you for any help > > ------------------------------ > View message @ > http://zend-framework-community.634137.n4.nabble.com/Zend-Db-data-array-and-quoting-question-tp3016954p3016954.html > To start a new topic under Zend Framework, email > ml-node+634138-1492779793-72...@n4.nabble.com<ml-node%2b634138-1492779793-72...@n4.nabble.com> > To unsubscribe from Zend Framework, click > here<http://zend-framework-community.634137.n4.nabble.com/template/TplServlet.jtp?tpl=unsubscribe_by_code&node=634138&code=cmFtb24ub3JuZWxhQGdtYWlsLmNvbXw2MzQxMzh8MTMxMDkxMjY1MQ==>. > > > -- View this message in context: http://zend-framework-community.634137.n4.nabble.com/Zend-Db-data-array-and-quoting-question-tp3016954p3016960.html Sent from the Zend Framework mailing list archive at Nabble.com.