| Index
» Projekty
» phpMyEdit
» Fórum
» Setting a value of a field to a wanted value |
 |
stanneo
Založený: 03.02.2011
Príspevky: 14
Zaslal: 2011-03-10 20:50
Návrat hore
Odpovedať s citátom
|
This field shows a date column from a DB:
$opts['fdd'] ['Ticketenddate']= array(
'name' => 'Ticketenddate',
'select' => 'T',
'maxlen' => 19,
'sort' => true,
Now I have a time variable like this:
$timestamp = time();
$datum = date("d.m.Y",$timestamp);
$uhrzeit = date("H:i",$timestamp);
$Enddate = $datum;
$Endtime= $uhrzeit;
I want to Insert this time variable in to the Database.
It works fine by adding a new data set, after I have added this code ---> 'default' => $Enddate.$Endtime,
);
Now the code looks like this :
$opts['fdd'] ['Ticketenddate']= array(
'name' => 'Ticketenddate',
'select' => 'T',
'maxlen' => 19,
'sort' => true,
'default' => $Enddate.$Endtime,
);
So far, so good.
But if I want to change a existing data record, the field shows the recorded values from the DB.
I want, the field will be filled with the default value - this means the neessary time variable, not the values
read from the database
I have tried code like this:
$opts['fdd'] ['Ticketenddate']= array(
'name' => 'Ticketenddate',
'select' => 'T',
'maxlen' => 19,
'sort' => true,
'value' => $Enddate.$Endtime,
'default' => $Enddate.$Endtime,
);
I hoped the code --> 'value' => $Enddate.$Endtime,
will set the value of the field to the wanted
time variable, and will override the really records read from the database, but it doesn't work.
How can I change this code,so that the field will be filled allways with the time variable by adding a new
and by changing an existing data set , and not only by adding a new data set?
Is there a solution for this problem at all?
Thank you
Greetings
stanneo
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2011-03-11 02:42
Návrat hore
Odpovedať s citátom
|
Perhaps Ticketenddate should be defined as
| Kód: |
| Ticketenddate NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP |
???
|
|
Odoslať novú tému
Odpovedať na tému
|
|
|
|