Welcome Guest, Not a member yet? Register   Sign In
DB Insert Timing
#3

(This post was last modified: 01-16-2023, 05:14 PM by SoccerGuy3.)

(01-16-2023, 04:49 PM)kenjis Wrote: Can you show minimum sample code?

Sure. Here it is (I cut out a bunch of stuff that isn't relative - the code works, it is just the time stamp I am questioning):

PHP Code:
$data = array(
 
'update_reason' => $update_reason.$statusMsg,
 .
 .
 .
 
'internal_notes' => $post['internal_notes'],
);

$this->lotsVersionModel->insert($data); <<-- Row shows a time stamp of say "2023-01-16 15:08:14.814000"

return redirect() ->to("/auction/lots/delete_lot_confirm/".$newID.'/'.$post['parent_id'])
 ->
with('info''Record updated successfully.');
 
*********
Confirmation screen opens
and User confirms which leads to:
*********

public function 
move_to_stockyard($lotVersionID,$masterID)
{
 
//Get the current auction # so we can return to that list
 
$record $this->lotsMasterModel ->select('auction_lots_master.auction_id')
 ->
where('id',$masterID)
 ->
first();
 
$data = array (
 
'auction_id' => 1,
 );
 
$this->lotsMasterModel->update($masterID,$data);

 
//close db connection to avoid duplicate time stamps
 
$this->lotsVersionModel->close();

 
//Need to update history to reflect move to Stockyard
 //duplicate record and change "reason"
 
 
$oldRow $this->lotsVersionModel->where('id',$lotVersionID)->first();
 
 
$oldRow['update_reason'] = '** Moved to Stockyard **';
 unset(
$oldRow->id);
 unset(
$oldRow->created_at);
 
 
$this->lotsVersionModel->insert($oldRow); <<-- Row shows an identical time stamp of"2023-01-16 15:08:14.814000"



In case it helps, the field definition:
Code:
`created_at` datetime(6) NOT NULL DEFAULT current_timestamp(3),
Reply


Messages In This Thread
DB Insert Timing - by SoccerGuy3 - 01-16-2023, 03:59 PM
RE: DB Insert Timing - by kenjis - 01-16-2023, 04:49 PM
RE: DB Insert Timing - by SoccerGuy3 - 01-16-2023, 04:59 PM
RE: DB Insert Timing - by kenjis - 01-16-2023, 05:20 PM
RE: DB Insert Timing - by SoccerGuy3 - 01-16-2023, 05:26 PM
RE: DB Insert Timing - by kenjis - 01-16-2023, 09:03 PM
RE: DB Insert Timing - by SoccerGuy3 - 01-17-2023, 10:58 AM
RE: DB Insert Timing - by kenjis - 01-17-2023, 06:37 PM
RE: DB Insert Timing - by SoccerGuy3 - 01-18-2023, 07:33 AM
RE: DB Insert Timing - by InsiteFX - 01-18-2023, 12:22 AM
RE: DB Insert Timing - by kenjis - 01-18-2023, 06:04 PM
RE: DB Insert Timing - by SoccerGuy3 - 01-27-2023, 11:02 AM



Theme © iAndrew 2016 - Forum software by © MyBB