Hello
I am trying to update the quantity value but I am not able to do it. As soon as the user clicks on Add To Basket, if the items exists I want it to update the value. At the moment, the quantity is one.
//so this bit checks if the item is already there
if ('SELECT `NameOfTheDVD`, `Qty` FROM `basket` WHERE `NameOfTheDVD` = '.$DVDname.'' ) {
$Update = 'UPDATE `basket`
SET Qty = Qty + 1
WHERE `NameOfTheDVD` = '.$DVDname.'';
$prepare = $dbhandle->prepare( $Update );
$prepare -> execute();
} else {
//if the item does not exist it just add the item
$query_insertintotable= 'INSERT INTO `basket` (DVDID, NameOfTheDVD, Qty, Price)
VALUES ('.$myid.',\''.$DVDname.'\',1,'.$price.')';
echo $query_insertintotable;
$query = $dbhandle->prepare( $query_insertintotable );
//$result = mysql_query($query_insertintotable);
$query->execute();
}
The other thing I dont know how to increment the value.
The problem is also with the if statement, I am not able to add any of the products even if it does not exist in the database
I hope you guys can help me
Thank you