Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Sunday, October 18, 2026
About Us
O nás
Magazine
Magazín
Open Source
Otvorený softvér
CVS
CVS
Services
Služby
Index  »  Projects  »  phpMyEdit  »  Forum  »  Setting a value of a field to a wanted value

phpMyEdit General     Setting a value of a field to a wanted value
Post new topic   Reply to topic    
 
stanneo     Joined: 03 Feb 2011   Posts: 14  
Post 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)
Post 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    

Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top · Feedback form · Odkazový formulár · Application form · Prihláška
Report bug on PLATON.SK website · Upozorniť na chybu na PLATON.SK webstránke · Terms of use · Podmienky použitia · Privacy policy · Ochrana osobných údajov