0

Helloo

Im new in Databases.
I want to create a simple shopping cart i have a table called product

CREATE TABLE  `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `category` varchar(150) NOT NULL,
  `name` varchar(100) NOT NULL,
  `author` varchar(100) NOT NULL,
  `details` varchar(10000) NOT NULL,
  `price` int(11) NOT NULL,
  `imgpath` varchar(500) NOT NULL,
  `dateadded` date NOT NULL,
  `stock` int(11) NOT NULL,
  PRIMARY KEY (`id`)
)

what i want is when i click the add to cart button the product must add to a cart i don't have a idea how to do this

3
Contributors
2
Replies
6
Views
7 Years
Discussion Span
Last Post by Benjip
0

Why don't you use the paypal cart cms or if you want it custom made then perhaps download a pre-made cart and see how they did it. But as for how to insert the item simply use the mysql_query("INSERT INTO `table` SET `column`='value', `another`='value2'"); Also you will need to send the user a cookie for identification.

Edited by cwarn23: n/a

0

I used a tutorial I found online to begin building my first shopping cart - it basically explains how to create a session-based 'cart' that a user can add products to. From there, it's up to you to learn how to take that cart and convert it into an order etc.

Here's the link: http://v3.thewatchmakerproject.com/journal/276/building-a-simple-php-shopping-cart

It's a fairly basic tutorial and it doesn't cover the likes of security etc. - you'll want to look into that as well! Hope it helps somewhat though :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.