Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 28. november 2026
O nás
Magazín
Otvorený softvér
CVS
Služby
Index  »  Projekty  »  phpMyEdit  »  Fórum  »  CURRENT_TIMESTAMP puts in all zeros on a timestamp.

phpMyEdit Installation     CURRENT_TIMESTAMP puts in all zeros on a timestamp.
Odoslať novú tému   Odpovedať na tému    
 
Android8675     Založený: 08.11.2011   Príspevky: 2  
Príspevok Zaslal: 2011-11-08 23:20
Návrat hore  Odpovedať s citátom     

Kód:
* This file was generated by:
*
*                    phpMyEdit version: 5.7.1
*       phpMyEdit.class.php core class: 1.215
*            phpMyEditSetup.php script: 1.50
*              generating setup script: 1.50

So trying to get a timestamp to update on a dB, whenever I Add a record, the timestamp reads "CURRENT_TIMESTAMP" greyed out, and when the record is entered the timestamp is 0000-00-00 00:00:00

the key and sort_field is set to the timestamp field (ts).

the table .php file has the following for the timestamp field:

Kód:
$opts['fdd']['ts'] = array(
  'name'     => 'Time',
  'select'   => 'T',
  'options'  => 'LFAVCPDR', // updated automatically (MySQL feature)
  'maxlen'   => 19,
  'default'  => 'CURRENT_TIMESTAMP',
  'sort'     => true
);


myphpadmin reports the field as:

Kód:

#   Column   Type      Null   Default
2   ts   timestamp  No   CURRENT_TIMESTAMP


Running MySQL 5.5.16

Any help appreciated.
-Andy

 
doug     Založený: 10.02.2003   Príspevky: 1013   Bydlisko: Denver, Colorado (USA)
Príspevok Zaslal: 2011-11-09 19:02
Návrat hore  Odpovedať s citátom     

When you export the schema using phpMyAdmin, if it reads as `ts` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, then
MySQL will manage the timestamp without intervention from the script, and thus probably set VLF as the only options. The following is probably all you'll need, assuming you do not have plans to manually modify the timestamp.

Kód:
$opts['fdd']['ts'] = array(
  'name'     => 'Time',
  'select'   => 'T',
  'options'  => 'VLF',
  'sort'     => true
);


 
Android8675     Založený: 08.11.2011   Príspevky: 2  
Príspevok Zaslal: 2011-11-15 18:16
Návrat hore  Odpovedať s citátom     

yeah, I want the time stamp to mark when the entry was made. I don't want it to update every time the record is modified. after a lot of google digging I found a fix that seems to work. The trick is to not display the time stamp in the form. That seems to save the time stamp correctly.

Kód:
$opts['fdd']['ts'] = array(
//  'colattrs|LF'   => '',
//  'css'        => array('postfix' => 'right-justify'),
  'default'    => 'CURRENT_TIMESTAMP',
  'help|ACP'   => 'Timestamp',
  'input'      => 'R',
  'maxlen'     => 19,
  'name'       => 'Time Stamp',
  'options'    => 'LFCVD',
  'select'     => 'T',
  'size|ACP'   => 19,
  'sqlw'       => 'TRIM("$val_as")',
  'sort'       => true
);


No idea how much of that it really needed, but it seems to save the timestamp now as it should.

Suggestions welcome.

 
Odoslať novú tému   Odpovedať na tému    

Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok · Odkazový formulár · Prihláška
Upozorniť na chybu na PLATON.SK webstránke · Podmienky použitia · Ochrana osobných údajov