我试图从我的会话['购物车']列出所有添加的产品并将其破坏,我只是不知道如何列出内爆,请帮忙!
$list = '';
foreach($_SESSION['cart'] AS $key => $qyt){
$items[] = array('size_id' => $qyt['size']);
}
$res = $db->Execute("SELECT s.name, p.item_num, p.name AS product_name, p.discount,
s.price AS product_price,s.units
FROM products_sizes s
INNER JOIN products p ON p.product_id = s.product_id
WHERE s.id IN (". implode(",", /* LIST SIZES_ID HERE */ ) .")
ORDER BY s.id DESC
");
while($row = $res->GetNext()){
答案 0 :(得分:1)
对于给出的示例,两个简单的更改就足够了:
foreach($_SESSION['cart'] AS $key => $qyt){
$items[] = $qyt['size'];
}
$res = $db->Execute("SELECT s.name, p.item_num, p.name AS product_name, p.discount,
s.price AS product_price,s.units
FROM products_sizes s
INNER JOIN products p ON p.product_id = s.product_id
WHERE s.id IN (". implode(",", $items) .")
ORDER BY s.id DESC
");
while($row = $res->GetNext()){