Hello I'd like to insert all from $_SESSION into rows $key with value $value
so something like foreach ($_SESSION as $key => $value) {}
Imlooking at:Best way to INSERT many values in mysqli?
name of rows in mysqli is same as names of given $key .I need to insert each $value in its $key (row)
Code:
$query = "INSERT INTO testtable VALUES (?)";
$stmt = $dbc->prepare($query);
$stmt->bind_param("s", $key);
$mysqli->query("START TRANSACTION");
foreach ($_SESSION as $key => $value) {
$stmt->execute();
}
$stmt->close();
$mysqli->query("COMMIT");