我在网上商店工作,我尝试将订单存储在数据库中。如果用户选择超过 1 个产品,我可以将最新选择的产品存储在数据库中。是否可以一键存储超过 1 个具有不同 ID 的产品?
我在其他页面“cart.php”上有这个
$pp_checkout_btn = "<a href='pp.php?post=' class='placeraorder'>Placera Order</a>";
if (isset($_SESSION['id'])) {
$postf=$_GET['post']; //
$userid = $_SESSION['id'];
$pris = $price;
$totalsumma = $price * $each_item['quantity'];
$produkt_id = $each_item['item_id'];
$antal = $each_item['quantity'];// I can store many quantity with this var with the same id
$storlek = $each_item['size'];
$färg = $each_item['color'];
mysql_query("INSERT INTO order_postf (produkt_id,userid,storlek,färg,pris,total_pris,antal,date) VALUES ('$produkt_id','$userid','$storlek','$färg','$pris','$totalsumma','$antal',now())")or die(mysql_error());
}