You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$db->transaction(function ($db) use ($data) {
$db->query('INSERT INTO users ?', $data);
$onboardId = $db->getInsertId();
if(isset($onboardId) and !empty($onboardId)){
//Now lets create user balance
$balanceData = array(
'username' => $data['username'],
'acnumber' => $data['acnumber'],
'loan' => 0,
'email' => $data['email'],
'balance' => 10000000
);
$db->query('INSERT INTO trans ?', $balanceData);
exit(json_encode(['code' => 200, 'success' => true, 'message' => 'success']));
} else {
//Log error and send to developer - This will be implemented later
exit(json_encode(['code' => 400, 'success' => false, 'message' => 'Something went wrong. Please try again later']));
}
});
If the trans table fails the users table does not roll back... Have tried using $db->beginTransaction() too none of the transaction methods are working.
The text was updated successfully, but these errors were encountered:
Transactions not working.
See sample
If the trans table fails the users table does not roll back... Have tried using $db->beginTransaction() too none of the transaction methods are working.
The text was updated successfully, but these errors were encountered: