I have been coding a website for a friend, everything worked fine on my localhost setup, then I FTP to their host and now it's broken....
the error is
Fatal error: Unknown(): The script tried to execute a method or access a property of an incomplete object. Please ensure that the class definition cart of the object you are trying to operate on was loaded _before_ the session was started in /index.php on line 40
line 40 of index.php is
Expand|Select|Wrap|Line Numbers
- $cart -> add($id,$qty,$price);
Expand|Select|Wrap|Line Numbers
- function add($prod_id,$qty,$price) {
- session_start();
- if (isset ($_SESSION['cart'][$prod_id])){
- $_SESSION['cart'][$prod_id]['qty'] += $qty;
- }
- else{
- $_SESSION['cart'][$prod_id] = array("qty"=>$qty,"price"=>$price);
- }
- }