This topic is locked
[SOLVED]

 Add a date with $data

2/4/2020 3:00:47 AM
PHPRunner General questions
P
PaulM author

when doing an update I want to save the old data to another table. I can do this successfully but now I want to add a date to show when the data was changed but cannot work out how to do it.
I've tried various versions of below to add the date but it doesn't work
$data["LH_status"] = $oldvalues["L_status"];

$data["LH_updated_date"] = $session["date()"];

DB::Insert("L_History", $data );

lefty 2/4/2020



when doing an update I want to save the old data to another table. I can do this successfully but now I want to add a date to show when the data was changed but cannot work out how to do it.
I've tried various versions of below to add the date but it doesn't work
$data["LH_status"] = $oldvalues["L_status"];

$data["LH_updated_date"] = $session["date()"];

DB::Insert("L_History", $data );


Try this:
$data = array();

$data["LH_status"] = $oldvalues["L_status"];

$data["LH_updated_date"] =now("%m-%d-%Y");

DB::Insert("L_History", $data );
// This would be for short date 2/4/2020 - Change m% d% %Y to your needs or to match same format as LH_update_date field . You may use - or / in between date values. Then view as date in project. Select view format short date or long date or you can //even use a custom view if need be.

P
PaulM author 2/4/2020



Try this:
();

$data["LH_status"] = $oldvalues["L_status"];

$data["LH_updated_date"] =now("%m-%d-%Y");

DB::Insert("L_History", $data );
// This would be for short date 2/4/2020 - Change m% d% %Y to your needs or to match same format as LH_update_date field . You may uses - or / in between date values.


Perfect - thanks