If you construct your Data Array properly with the fields you want to
save you can directly call $this->User->save()

So you already have $user['User']['id'];

Add to it

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

Then just save it

Read http://book.cakephp.org/view/1031/Saving-Your-Data

HTH

Tarique

On Wed, Sep 7, 2011 at 12:24 PM, Richard Neil Roque
<[email protected]> 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.
>
> --
> 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
> [email protected] For more options, visit this group at 
> http://groups.google.com/group/cake-php
>



-- 
=============================================================
PHP for E-Biz: http://sanisoft.com
=============================================================

-- 
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
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to