Please see below code,
$friendslist = "232,72,284,345";
$id = 1028;
$friendarray = explode(",", $friendslist);
$frienduserarray = array();
for ($n = 0; $n < count($friendarray); $n++) {
$friendidpush = "('".$id."','".$friendarray[$n]."'),";
array_push($frienduserarray, $friendidpush);
}
$query = "INSERT INTO freddyhipment (id, order) VALUES ";
$friendarray = explode(",", $friendslist);
foreach ($friendarray as $order) {
$query .= "('" . $id . "','" . $order . "'),";
}
$query = substr($query, 0, -1); // remove trailing comma
if (mysqli_query($conn,$query)) {
echo "Data saved in Database successfully,Clik to go in <a href='index.php'>System</a><br /> ";
}
else {
echo "Data not saved,Clik to go in <a href='index.php'>System</a>" . mysqli_error($conn);
}
Iβm getting below error. Please help.
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near βorder) VALUES (β1028β,β232β),(β1028β,β72β),(β1028β,β284β),(β1028β,β345β)β at line 1