Oct 4, 2018
0
Level 2
Multiple for Submission or Issue with Insert Query?
Hi All,
i have a weird issue, i have a form that a user submits with a card number, my script does some checking and ultimately submits a transaction to the database.
recently, it has been running the insert query multiple times and i cant figure out why.
At first i thought it was form submitting more than once but I have all my error or success for the form redirecting back to the page with
return redirect::to('/transactions/create');
so as not to submit another post request.
This is my inster query:
DB::beginTransaction();
try
{
$tdata['ClientID'] = $check_client[0]->ClientID;
$tdata['Swipe_Card_Key'] = $select_client[0]->Swipe_Card_Key;
$tdata['Timestamp'] = now();
$insert_transaction_data = DB::table('Client_Transactions')->insert($tdata);
if($insert_transaction_data) {
DB::commit();
} catch (\Exception $e) {
Log::error($e->getMessage());
}
}
Any ideas why this could be happening? THe timestamps on insterted data are all within 1 milliesecond
Please or to participate in this conversation.