From: jim k. <jim...@ya...> - 2003-05-23 15:17:54
|
the evaluation time of 'default'=>date('Y-m-d H:i:s') is at _add/update_page_generation_ time, not submit time. If the user requests a record for add or update and then doesn't submit the page for 15 minutes or a couple of days, it's going to be off by that much. If you need very accurate information in this field, this won't work at all. suggestions: 1. within existing framework, a. if you want only insert time, then use a pre-insert trigger to set the time field b. if you want last updated times, then you could - make the column definition be a timestamp or - use both pre-insert and pre-update trigger to set the time field 2. extend PME by adding an 'eval' field option. 'eval'=>Array( 'eval_time'=>'IU', // I(nsert) and U(pdate) 'expr'=>"date('Y-m-d H:i:s')", 'expr_type'=>'sql' // sql or php ), where the expr is eval'd (security warning!) by either PHP or MySQL --jim --- Ondrej Jombik <ne...@po...> wrote: > > I am trying to enter the current date and time into a date field. Not > > a timestamp field because, I don't want this field to change when the > > record is updated. > > The only approach I can think of, is to add a button or pulldown, on > > the modify record page, when clicked it will add in a time. When not > > clicked it leaves the date field unmodified. > > Try this, it works well for me with 5.3 and current CVS as well. > > $ezin_opts['fdd']['datetime'] = array( > 'name'=>Platon::htmlspecialchars2('Date & Time'), > 'select'=>'T', > 'sort'=>true, > 'required'=>true, > 'mask'=>'%.10s', > 'default'=>date('Y-m-d H:i:s') > ); > > This is rough paste from my phpMyEzin project files, however point on > 'default' option above. > > > I am trying to insert the now() command into the [fdd] area of the > > field, although I haven't had good results, hence this post. > > This will be _probably_ possible in 5.4... Something like: > > $opts['fdd']['col_name']['sql|AC'] = 'NOW()'; > > -- > _/| Ondrej Jombik - ne...@ph... - http://www.nepto.sk - OJ812-RIPE > <_ \ Platon SDG - open source software development - http://platon.sk > `\| This message was written with Pine, the fastest IMAP mail client > '` > > > ------------------------------------------------------- > This SF.net email is sponsored by: ObjectStore. > If flattening out C++ or Java code to make your application fit in a > relational database is painful, don't do it! Check out ObjectStore. > Now part of Progress Software. http://www.objectstore.net/sourceforge > _______________________________________________ > Phpmyedit-discuss mailing list > Php...@li... > https://lists.sourceforge.net/lists/listinfo/phpmyedit-discuss __________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com |