Re: Saving NOW() in model

2008-05-22 Thread francky06l
I use date(DATE_ATOM) for date / timestamp fields, one could argue that there might be different time-zone between the web-server and the db server :-) If you really need the DB timestamp, better using '!- NOW()' as Stephen mentionned. On May 22, 4:35 pm, fr3nch13 <[EMAIL PROTECTED]> wrote: > Mos

Re: Saving NOW() in model

2008-05-22 Thread fr3nch13
Most likely uses php's time (didn't check), but a good reason for this is to allow supporting of multiple databases (or even flat files) instead of db specific functions. On May 22, 10:25 am, Zifnab <[EMAIL PROTECTED]> wrote: > Ok, well for consistency's sake, do you know if cakePHP's automatic >

Re: Saving NOW() in model

2008-05-22 Thread Zifnab
Ok, well for consistency's sake, do you know if cakePHP's automatic filling of 'created', 'updated', and 'modified' fields uses PHP's time or MYSQL's time? Thanks for all the quick responses everyone :) On May 22, 7:11 am, djiize <[EMAIL PROTECTED]> wrote: > yes you're right! > I care about that

Re: Saving NOW() in model

2008-05-22 Thread djiize
yes you're right! I care about that because we have 1 MySQL central server and several servers that request it. And we have not always full control of theses servers (apps can be coded by others teams/companies). On 22 mai, 14:16, Joel Perras <[EMAIL PROTECTED]> wrote: > It doesn't really matter

Re: Saving NOW() in model

2008-05-22 Thread Joel Perras
It doesn't really matter whether or not you obtain the date from Apache/PHP or MySQL; as long as you are consistent. On May 22, 4:01 am, djiize <[EMAIL PROTECTED]> wrote: > I use the same way as Stephen > Because what if MySQL is hosted on another server than Apache/PHP ? > You'll save Apache/PHP

Re: Saving NOW() in model

2008-05-22 Thread djiize
I use the same way as Stephen Because what if MySQL is hosted on another server than Apache/PHP ? You'll save Apache/PHP time which can be different of MySQL time (no the same meridian for instance). Of course, it's a very specific case. And my servers are time synchronised together, but some time

Re: Saving NOW() in model

2008-05-21 Thread Stephen Orr
I believe I used this method: 'last_login' => '!-NOW()' Which makes Cake stop trying to quote it. But I'm pretty sure the latest SVN revision recognises NOW() and doesn't quote it anyway. Maybe I'm confused. Steve On May 22, 2:12 am, Alex Ciobanu <[EMAIL PROTECTED]> wrote: > Zifnab wrote: > >

Re: Saving NOW() in model

2008-05-21 Thread Alex Ciobanu
Zifnab 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, fals

Re: Saving NOW() in model

2008-05-21 Thread Joel Perras
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' =>

Re: Saving NOW() in model

2008-05-21 Thread Jonathan Snook
Try: $aUserData = array( 'User' => array( 'id' => 4, 'last_login = NOW()' ) ); On Wed, May 21, 2008 at 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

Saving NOW() in model

2008-05-21 Thread Zifnab
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' ) ); Natu