How can the issue of only inserting one entry from the 'warenkorp' table be addressed in the PHP script provided?

The issue of only inserting one entry from the 'warenkorp' table can be addressed by using a loop to iterate through each item in the 'warenkorp' array and execute the SQL query to insert each item separately into the database.

// Loop through each item in the 'warenkorp' array and insert into the database
foreach ($warenkorp as $item) {
    $sql = "INSERT INTO warenkorp (product_id, quantity) VALUES ('" . $item['product_id'] . "', '" . $item['quantity'] . "')";
    $result = mysqli_query($conn, $sql);
    
    if (!$result) {
        echo "Error: " . $sql . "<br>" . mysqli_error($conn);
    }
}