It is necessary to insert records into the table in a loop. The logic is that the same order identifier is inserted into the OrderID field, and the identifiers of all products added to the order into the ProductID field. I'm trying this:
$ids=array_keys($productsInCart); for ($i=0;$i<count($ids);$i++){ $query ="INSERT INTO tblOrderProduct (OrderID,ProductID) VALUES('$orderid','$ids')"; $mysqli->query($query); } The $productsInCart array contains product IDs and their quantity, respectively. In general, it does not work, tell me what's wrong.