Having read the session ref, it says that I can
which I have done, but it still breaks. I have a horrible feeling that it is something to do with globals, but having never used them are unsure of how to solve that.You can substitute $HTTP_SESSION_VARS for $_SESSION, if you prefer the former.
the snippet of code that breaks first is
Code: Select all
<?php
function recalculate(){
//This is used to update the variables holding the number of items and the price.
//It should decrease the number of database queries since get_total will not need
//to do any connections
$HTTP_SESSION_VARSї'total'] = 0.0;
foreach ($HTTP_SESSION_VARSї'products'] as $prod){
$query = "Select price from ProductCategory pc, Product p where p.pcid = pc.pcid and p.productID = '".$prodї'pid']."'";
if (!$this->db->query($query)){
die($this->db->error());
}
//retrieve the price and add it on to the total
$row = $this->db->fetchAssoc();
$HTTP_SESSION_VARSї'total'] += ($rowї'price'] * $prodї'quant']);
}
}//recalculate
?>Any help is greatly appreciated
Duncan