How to write data from a php loop in the database?

Good afternoon.
I accept data in a json array and then cycle bring them to the page in a table. Tried to record this fact in the database, but is recorded only the first iteration.
Prompt, please, the method by which you can make to the dB each iteration?
Code simplified and limited to understand.
foreach($json['data']['calls'] as $class) {
 $date = $class['dateTimeUtc'];
 $data = substr("$date", 0, 10);
 $time = substr("$date", 11, -5);

 echo '<tr>';
 echo '<td>'; echo '<input name="bus" value="'; echo $class['businessNumber']; echo '"></input> '; echo '</td>';
 echo '<td>'; echo '<input name="date" value="'; echo $data; echo '"></input> '; echo '</td>';
 echo '<td>'; echo '<input name="time" value="'; echo $time; echo '"></input> '; echo '</td>';
 echo '<td>'; echo '<input name="phone" value="'; echo $class['caller']['phone']; echo '"></input><br> '; echo '</td>';
 echo '</tr>';
 }

$bus = $_POST['bus'];
$date = $_POST['date'];
$time = $_POST['time'];
$phone = $_POST['phone'];
$SQL = "INSERT INTO Calls (bus, call_date, call_time, phone_number) VALUES ('$bus', '$date', '$time', '$phone')";
$result = mysqli_multi_query($link, $SQL);
March 23rd 20 at 18:43
1 answer
March 23rd 20 at 18:45
Solution
Why should there multi_query, if one is called an INSERT query?
Before the loop do prepare, bind the parameters using bind_param. In a loop set variable values and call execute.
Why should there multi_query, if one is called an INSERT query?

I copied mindlessly from your previous code, where there were several actions with the database directly :( - Si commented on March 23rd 20 at 18:48
Thanks, it worked)
And can you tell me at the same time, is it possible to mysqli_prepare use several expressions as multi_query?
UPD: Googled that one operator can prepare prepare only one request :( - Si commented on March 23rd 20 at 18:51
@Si, you have some kind of unhealthy attraction to multi kveri. Believe me, there was no serious reason to use this function in regular scripts no - fredric commented on March 23rd 20 at 18:54

Find more questions by tags MySQLPHP