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

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.

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 :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.