How to Create a Simple PHP MYSQL Shopping Cart .pdf
Original filename: How to Create a Simple PHP MYSQL Shopping Cart.pdf
Title: HOW TO CREATE A PHP MYSQL SHOPPING CART
Author: W.S. Toh
This PDF 1.7 document has been generated by Microsoft® PowerPoint® 2016, and has been sent on pdf-archive.com on 31/05/2018 at 03:16, from IP address 58.182.x.x.
The current document download page has been viewed 158 times.
File size: 273 KB (10 pages).
Privacy: public file
Download original PDF file
CREATE A PHP MYSQL
I am Robert Tou
I am a web developer and
share the love for
programming by giving
Everyday life is like programming, I guess.
If you love something you can put beauty
- Donald Knuth
1) THE DATABASE
Create a database to hold the products and orders first.
Products – Product ID, Name, Description.
Orders – Order ID, Name, Order Date.
Ordered Products – Product ID, Order ID, Quantity.
You can further expand on the database, but these
should are the basic requirements.
2) PRODUCTS CATALOG
» Create a HTML page to pull and display the products.
» Connect to the database, and use a simple “SELECT *
FROM `products`” SQL query to pull the data.
» Use a while loop to generate a table, layout the products
as you deem fit.
» Remember to attach an “add to cart” button for each
3) CART ACTIONS I
» Recommended to use AJAX to handle the add to cart.
» Use jQuery to speed up your development.
» Pass the selected product ID via AJAX to another PHP
script to handle the add action.
» Start the session, and record the cart in a simple array of
product ID => quantity.
4) CART ACTIONS II
» Handle the rest of the actions in a similar manner via
» Change quantity and remove items from the session cart.
» Show the checkout button if there is at least 1 item in the
» Similar AJAX process.
» Record cart into the database, wipe off the session, then
redirect the customer to a thank you page.
For the complete guide and source code,
please visit Code Boxx: