0

creating a simple shopping carts using php and mysql

please help me....i want to create a simple shopping cart using php and my sql...for my school project..thank you

7th Oct 2017, 9:44 AM
Dark Smile
Dark Smile - avatar
1 Réponse
+ 15
I would do it like this: The basket system would require these tables in your database to work: Customer, Basket, Item and BasketItems. for Customer and Item, we only care about the ID Basket needs, at least, columns ID and customerID then BasketItems has three columns: ID, basket ID and itemID now, in PHP, you'll need a class called Basket which has the following methods: addToBasket($itemID){} removeFromBasket($itemID){} getAll(){} each of which will perform a query on your database to get the correct items from BasketItems. the current customer's ID and basket ID should be stored either in the session or in a cookie or both.
8th Oct 2017, 11:11 PM
Aidan Haddon-Wright
Aidan Haddon-Wright - avatar