Hey guys,
Lovely forum. So I'm building a simple shopping cart from php and mysql. Whenever I update the quantity of the item that I want, I don't want it to duplicate all of the information but instead want it to merge the quantity together.
Below is an example of what happens. Note that Test Item has been added to the cart 3 separate times with different quantities (2, 1, and 1). How can I merge this information to show Test Item once with the total quantity? I know it's some kind of merge, but I'm a coding noob. Thanks!
Here is some (maybe) relevant information:
$insert = "INSERT INTO new_cart (sku, quantity, username) VALUES ('".$ssku."', '".$squantity."', '".$username."')";
mysql_query($insert);
}
echo "<table>";
$select = "SELECT * FROM new_cart JOIN products ON new_cart.sku = products.sku where '".$username."' = new_cart.username";
What needs to be changed or updated?
EDIT: If you need more information, feel free to let me know and I'll post it.