如何获得我的数组的结果?
我试过了:
if (isset($_SESSION["cart_array"]) && is_array($_SESSION["cart_array"])) {
foreach ($_SESSION["cart_array"] as $each_item) {
$id = $each_item["item_id"];
$qty = $each_item["quantity"];
$sql = mysql_query("SELECT * FROM promo WHERE code='$id' LIMIT 1");
while ($row = mysql_fetch_array($sql)) {
$price = $row["price"];
$cartTotal = $price * $qty;
echo "$cartTotal,";
}
}
}
提前致谢。