I think what you are looking for is this:

http://api.cakephp.org/2.3/class-DboSource.html#_expression

      $this->Invite->id = $data['Invite']['id'];
      $this->Invite->set(array(
        'send_count' => 
$this->Invite->getDataSource()->expression('send_count + 1'),     
        'sent'       => $this->Invite->getDataSource()->expression('NOW()')
      ));
      $this->Invite->save();

~Jonathan

On Wednesday, September 7, 2011 2:54:12 AM UTC-4, Richard Neil Roque wrote:
>
>
> 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.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to