Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
create table stage_1 (
tournament_id int,
team_id int,
group_id int,
points int
);
<?php
$data = [
[
'tournament_id' => 1,
'team_id' => 1,
'group_id' => 1,
'points' => 1
],
[
'tournament_id' => 1,
'team_id' => 2,
'group_id' => 1,
'points' => 1
],
];
$db::beginTransaction();
try {
foreach ($data as $d) {
$db::table('stage_1')
->where('tournament_id', $d['tournament_id'])
->where('team_id', $d['team_id'])
->where('group_id', $d['group_id'])
->update(['points' => $d['points']]);
}
$db::commit();
} catch (\Exception $e) {
$db::rollback();
}