It is only allowing me to update resulting in a total of 2
Heres my Table
CREATE TABLE `cart` (
`id` int(7) NOT NULL AUTO_INCREMENT,
`User` int(7) DEFAULT NULL,
`Product` varchar(100) DEFAULT NULL,
`Quantity` int(7) DEFAULT NULL,
UNIQUE KEY `id` (`id`),
UNIQUE KEY `Quantity` (`Quantity`)
)
Then, my code to insert the data is:
$a = '1'
query2 = " INSERT INTO CART(User, Product,Quantity)
VALUES
('$id','$model_number','$a')
ON DUPLICATE KEY UPDATE Quantity=Quantity+1";
It will work when I Add the data to the database but, upon my second attemp I get this error:
Duplicate entry '2' for key 'Quantity'