close(); } $CartID = getCartId($_SESSION['InvoiceID'], '1'); //-- Check for special items, size = namestamp if($_GET['id'] == '603' && $_GET['size']) { //-- check if item is already in basket. $connect = connect(); $query2 = mysqli_query($connect, "SELECT * FROM cart_special_items WHERE sitem_cart = '$CartID' AND sitem_item = '$_GET[id]' AND sitem_value_1 = '$_GET[name]' AND sitem_value_2 = '$_GET[font]'"); $connect -> close(); if (mysqli_num_rows($query2) > 0) { //-- item already exists, update amount. $connect = connect(); $query2 = mysqli_query($connect, "UPDATE cart_special_items SET sitem_amount = sitem_amount + 1 WHERE sitem_cart = '$CartID' AND sitem_item = '$_GET[id]' AND sitem_value_1 = '$_GET[name]' AND sitem_value_2 = '$_GET[font]'"); $connect -> close(); //echo 'item amount updated! 1'; } else { //-- item doesn't exist, insert now. $connect = connect(); $query2 = mysqli_query($connect, "INSERT INTO cart_special_items (sitem_cart, sitem_item, sitem_size, sitem_value_1, sitem_value_2, sitem_amount) VALUES ('$CartID', '$_GET[id]', '$_GET[size]', '$_GET[name]', '$_GET[font]','1')"); $connect -> close(); //echo 'item added! 1'; } header("location:item.php?id=".$_GET['id']."&value1=".$_GET['name']."&value2=".$_GET['font']); } else { //-- check if item is already in basket. $connect = connect(); $query2 = mysqli_query($connect, "SELECT * FROM cart_items WHERE citem_cart = '$CartID' AND citem_item = '$_GET[id]' AND citem_size = '$_GET[size]'"); $connect -> close(); if (mysqli_num_rows($query2) > 0) { //-- item already exists, update amount. $connect = connect(); $query2 = mysqli_query($connect, "UPDATE cart_items SET citem_amount = citem_amount + 1 WHERE citem_cart = '$CartID' AND citem_item = '$_GET[id]' AND citem_size = '$_GET[size]'"); $connect -> close(); //echo 'item amount updated! 2'; } else { //-- item doesn't exist, insert now. $connect = connect(); $query2 = mysqli_query($connect, "INSERT INTO cart_items (citem_cart, citem_item, citem_size, citem_amount) VALUES ('$CartID', '$_GET[id]', '$_GET[size]', '1')"); $connect -> close(); //echo 'item added! 2'; } header("location:item.php?id=".$_GET['id']); } } else { header("location:index.php"); } ?>