This script works under PHP 5 but not under PHP 4. I keep losing the contents of my session variables when I go from page to page. Any ideas on if anything in this code isn't compatible with PHP 4?
thanks
session_start();
require('phpscripts/functions.php');
require('phpscripts/dbconnect.php');
@$new = $_GET['new'];
@$item_id = $new;
@$_SESSION[ 'item_id' ] = $item_id;
check_valid_user();
require('main_top.php');
$query = "SELECT item_id, description, msrp FROM item WHERE item_id = '$item_id'";
$result = mysql_query( $query ) or die("mysql_query failed ".mysql_error());
$row = mysql_fetch_array( $result );
$query_description = "select image, extension from item_description where item_id = '$item_id'";
$result = mysql_query($query_description);
$row = mysql_fetch_array($result);
$image_ext = stripslashes($row['extension']);
$image_path = $item_id.$image_ext;
//if new item selected
if($new)
{
if( !isset($_SESSION[ 'cart' ]) )
{
$_SESSION['cart'] = array();
$_SESSION['img'] = array();
$_SESSION['item_price'] = array();
$_SESSION['items'] = 0;
$_SESSION['total_price'] = 0.00;
}
if( isset($_SESSION['cart'][$item_id]) )
$_SESSION['cart'][$item_id]++;
else{
$_SESSION['cart'][$item_id] = 1;
}
$_SESSION['img'][$item_id] = $image_path;
$_SESSION[ 'imageExist' ][$item_id] = $image_ext;