How to create a shopping cart with admin panel using PHP & MySQL

To learn how to create a shopping cart using PHP and MySQL with an admin panel, then you must check out the playlist embedded below.

In this playlist you will learn, how to :
  • Add or remove items from shopping cart
  • Increase or decrease items quantity
  • Show total cost of each item with respect to quantity
  • Show grand total
  • Place order with details
  • Create a secure admin login panel
  • Show user orders in the admin panel

Some common problems & their solutions

1. “Cannot run query” alert is shown and query does not runs?

It may be because you may have written table or column names in single quotes(‘ ‘). 

Eg: "SELECT * FROM 'table_name' WHERE 'columun_name'='value';

The above query is wrong and will not execute because you must write table and column names in backticks (` `).

Eg: "SELECT * FROM `table_name` WHERE `columun_name`='value';

2. Total of an item does not increase on updating quantity?

It may be because you have made some mistakes in JavaScript code.

A. Making spelling mistakes in 

document.getElementsByClassName('itotal')
document.getElementsByClassName('price')
document.getElementsByClassName('quantity')

B. Giving a dollar or rupee symbol in the product price.

<input type='hidden' name='Item_Price' value='$852'>

Do not give a dollar or rupee symbol in the item price input field in the index.php page. Write only numbers like this:

<input type='hidden' name='Item_Price' value='852'>

3. Grand total is not showing?

It may be because you have made spelling mistakes in 

document.getElementById('g_total');

Make sure you write “element” not “elements” in document.getElementById() function.

Share