if (isset($_GET['Prod'])){
$prod=$_GET['Prod'];
$IsWish=$_GET['IsWish'];
if($IsWish==1){
//USER MUST BE LOGGED IN**********
if ($idUser==""){
//Error User must be logged in
$str="
Users must be logged in to add to the Wish List.
";
}
else{//insert into wishlist
$q="DELETE FROM wishlist WHERE idAppDesign = $prod AND idUserAccount = $idUser";
$mysqli->query($q);
$q="INSERT INTO wishlist (idUserAccount, idAppDesign) VALUES ($idUser, $prod)";
$mysqli->query($q);
$str="
Successfully added to the Wish List.
";
}
}
else{
//echo $prod;
$CartTable="";
if (!$idUser==""){
//Use the user table with the idUser
$CartTable="cartlist";
}
else{
//Use the Guest Cart
$CartTable="guestcart";
$idUser=$_SESSION['HappyGuest'];
}
$q="Select idAppDesign FROM $CartTable WHERE idAppDesign = $prod
AND idUserAccount = '" . $idUser . "'";
//echo $idUser;
$str="";
$IsFound=0;
$result=$mysqli->query($q);
while ($row=mysqli_fetch_array($result)){//check if row found
//echo "found";
$IsFound=1;
}
if ($IsFound==1){
$str="