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
<?php
$array = [
'098A',
'mike',
'Street17',
'LA',
'07AA',
'steve',
'Street14',
'LA'
];
$stmt = $mysqli->prepare('INSERT INTO my_table (col1, col2, col3, col4) VALUES (?,?,?,?)');
foreach (array_chunk($array, 4) as $row) {
$stmt->execute($row);
}
var_export(
$mysqli->query('SELECT * FROM my_table')->fetch_all(MYSQLI_ASSOC)
);