2009年8月11日星期二

Re: [fw-db] update Zend_Db_Table_Abstract

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkqB05UACgkQadOAzz84lo/fRwCfUZjqMyF3zpwXwivMFA58dCMt
fbEAoJq8ZS6oDUUAqytiSatRNw60ZNCY
=m0sD
-----END PGP SIGNATURE-----
Have you tried this ?

myModel = new MyTableModel();
myModel->update('col1' => new Zend_Db_Expr('col1 + 2') , 'id = 1');
--
Rafał (ert16) Trójniak
WEB : http://trojniak.net/
m@il : ert256@gmail.com
Jid : ert256@gmail.com
GPG key-ID : 3F38968F
4711 E3BC B674 C841 BED8
0F8F 69D3 80CF 3F38 968F


PHPScriptor <contact@phpscriptor.com>
[Tue, 11 Aug 2009 13:38:36 -0700 (PDT)] :

>
> Hello,
>
> I want to add x to a column (int). In mysql something like this:
>
> update mytable set col1 = col1 + 2 where id = 1
>
> I tried this:
>
> myModel = new MyTableModel();
> myModel->update('col1' => 'col1' + $x, 'id = 1');
>
> but this isn't working? Is there a simple way, where I don't have to get
> the record first by e.g. fetchRow()?
>
> -----
> visit my website at http://www.phpscriptor.com/
> http://www.phpscriptor.com/

没有评论: