Tuesday, September 6, 2011

How can i update a field using a function

Hi i'm a new developer using CakePHP.
I would like to know
How can i update a field using a function.
Example is

UPDATE Users SET AGE=AGE+2+3+4 WHERE id=1???

Currently i do have a code like this one.

$this->User->id = $user['User']['id'];
$this->User->saveField('count_login', 'count_login+1');
$this->User->saveField('last_login', date('Y-m-d H:i:s'));

Thanks.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: