| Index
» Projects
» phpMyEdit
» Forum
» Setting a value of a field to a wanted value |
 |
stanneo
Joined: 03 Feb 2011
Posts: 14
Posted: 2011-03-10 20:50
Back to top
Reply with quote
|
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
Joined: 10 Feb 2003
Posts: 1013
Location: Denver, Colorado (USA)
Posted: 2011-03-11 02:42
Back to top
Reply with quote
|
Perhaps Ticketenddate should be defined as
| Code: |
| Ticketenddate NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP |
???
|
|
Post new topic
Reply to topic
|
|
|
|