Just get the PHP equivalent timestamp; it'll be easier and yield the
same result, unless your application takes minutes/hours/days to
insert or update a DB row.  In which case, you have much bigger
problems ;-)

$aUserData = array(
    'User'  =>  array(
        'id' => 4,
        'last_login' => date('Y-m-d h:i:s')
    )
);

Where I believe the MySQL datetime is in the format Year-Month-Day
Hour:Minute:Second; please forgive me if I'm wrong, it's late here.

-Joel.

On May 21, 6:55 pm, Zifnab <[EMAIL PROTECTED]> wrote:
> I'm trying to figure out how to implicitly make a mysql NOW() call
> when doing a model save...here's an example of the code:
>
> $aUserData = array(
>     'User'  =>  array(
>         'id' => 4,
>         'last_login' => 'NOW()'
>     )
> );
>
> $this->User->save( $aUserData, false, array( 'last_login' ) );
>
> Naturally the save doesn't work, because NOW() saves as a string
> "NOW()" instead of as a mysql function NOW()....How do I get it to
> save as a mysql function?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to