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
|
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
); |
|
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.
|