I have this loop at the moment, but it involves calling the database 5 to 10 times. Is there a way I can just call it once, perhaps with a while loop, or any other alternatives anyone can think of, as it is slowing down the action.
foreach($_SESSION['cart_array'] as $each_item) {
$item_id = $each_item['item_id'];
$each_quantity = $each_item['quantity'];
$item_qry = mysql_query("SELECT * FROM `products` WHERE `products_id`=$item_id");
$item_row = mysql_fetch_assoc($item_qry);
$product_price = $item_row['products_price'];
$total_price += $product_price * $each_quantity;
}