This guide walks you through building an Online Shopping Portal in PHP and MySQL from the ground up, a multi-category online store project complete with source code. Instead of only downloading it, you will understand how each part works: the database schema, product categories, the shopping cart, checkout and orders, and the admin panel. That understanding is what turns a downloaded project into something you can explain in a viva, extend for an assignment, or showcase in your portfolio.
Jump to download & setup
- What an online shopping portal includes
- The database schema (categories, products, users, orders)
- How categories organize the catalog
- How the shopping cart works
- How checkout creates an order
- The admin panel and login
- Setup: running it on your machine
- How to extend it for your own project
1. What an online shopping portal includes
An online shopping portal is a web store where customers browse products across several categories, add items to a cart, and place an order at checkout. It is the general form of e-commerce: where a single-product shop sells one kind of item, a portal organizes many products under categories like electronics, clothing, and books, and lets customers shop across all of them. Building one in PHP and MySQL is one of the most valuable student projects because it brings together every core skill, database design, CRUD, sessions, relationships between tables, authentication, and the cart-to-order flow, in a system everyone understands.
The version in this guide includes a category-organized product catalog, user registration and login, a session-based shopping cart, checkout that creates an order, order history, and an admin panel to manage categories, products, and orders. That is enough to be a complete, demonstrable project while staying clear enough to fully understand.
2. The database schema
The schema is the backbone of the project, so it is the best place to start. The shopping portal uses these core tables.
| Table | What it stores | Key columns |
|---|---|---|
categories | Product groups (electronics, clothing, etc.) | id, name |
products | Each item for sale | id, name, category_id, price, image, stock |
users | Customers and the admin | id, name, email, password, role |
orders | A completed purchase | id, user_id, total, order_date, status |
order_items | The products inside each order | id, order_id, product_id, quantity, price |
The relationships are the key idea. Each product belongs to a category, a user places many orders, an order contains many products, and the order_items table records exactly what was bought and at what price. The difference from a single-product shop is the categories table and the category_id on products, which is what makes this a multi-category portal rather than a one-type store. Understanding this diagram is understanding most of the project.
order_items (so a past order remembers what was actually paid, even if the product price changes later). Both are exactly the kind of decisions an examiner will ask you to justify.
3. How categories organize the catalog
Categories are what turn a flat list of products into a browsable portal. Each product carries a category_id linking it to its category, so the storefront can show “all electronics” or “all clothing” with a simple filtered query, and a category menu can list every available group.
// show all products in one category SELECT p.name, p.price, p.image FROM products p JOIN categories c ON p.category_id = c.id WHERE c.name = ?
The admin manages products and categories with CRUD. Adding a product, with values from a form, uses a prepared statement:
// add a product (simplified) $stmt = $conn->prepare( "INSERT INTO products (name, category_id, price, image, stock) VALUES (?, ?, ?, ?, ?)" ); $stmt->bind_param("sidsi", $name, $categoryId, $price, $image, $stock); $stmt->execute();
The prepared statement with bind_param, rather than dropping form values into the SQL string, is how you prevent SQL injection, a core security habit in PHP and a detail that marks a project you understand rather than one you copied.
4. How the shopping cart works
The cart needs to remember items as the user moves between pages, which is done with a PHP session: the cart lives in $_SESSION as an array of product IDs and quantities, so it persists across the visit without touching the database until checkout.
// add an item to the session cart session_start(); if (!isset($_SESSION['cart'])) $_SESSION['cart'] = []; $id = $_POST['product_id']; $_SESSION['cart'][$id] = ($_SESSION['cart'][$id] ?? 0) + 1;
Using the product ID as the array key means adding the same item twice simply increases its quantity rather than creating a duplicate line. The cart page loops over this array, looks up each product, and shows a running total. Understanding that the cart is a session array, not a database table, is a common “aha” moment, and explaining it shows you grasp how PHP maintains state across requests.
5. How checkout creates an order
Checkout turns the temporary session cart into a permanent record. The code creates one row in orders for the purchase, then one row in order_items for each product in the cart, copying the current price into each line. Because the order and its items must all save together, this is the natural place for a transaction, which groups the queries so an order is never left half-created.
// turn the cart into an order (core idea) // 1. insert the order header, get its new id INSERT INTO orders (user_id, total, order_date, status) VALUES (?, ?, NOW(), 'pending') // 2. for each cart item, insert a line into order_items INSERT INTO order_items (order_id, product_id, quantity, price) VALUES (?, ?, ?, ?) // 3. clear the session cart
After the order is saved, the session cart is emptied and the user sees a confirmation. This cart-to-order flow is the heart of any e-commerce project, and being able to walk an examiner through it, session cart, order header, line items, then clear, demonstrates that you understand the full lifecycle of a purchase.
6. The admin panel and login
The portal sits behind authentication, with the role column separating customers from the admin. The admin panel manages categories, products, and orders, and can update an order’s status. The login verifies a hashed password with password_verify and stores a session that protected pages check. The dashboard is a set of small queries you now understand: total products, total orders, revenue, and low-stock items. Knowing the schema, you can add any new figure yourself just by writing its query.
7. Setup: running it on your machine
To run the project locally you need a PHP environment with MySQL, most commonly XAMPP on Windows or its equivalent on Mac and Linux. The steps are:
- Install XAMPP and start the Apache and MySQL services.
- Copy the project folder into the
htdocsdirectory. - Open phpMyAdmin, create a database, and import the included
.sqlfile to create the tables. - Open the project’s config file and set the database name, user, and password to match your setup.
- Visit the project in your browser through
localhostand log in with the default admin credentials in the guide.
The complete online shopping portal in PHP with MySQL, including all source files and the database, is ready to download and run by following the steps above.
Download source code
Replace this link with your actual download URL.
8. How to extend it for your own project
Assignments and portfolios reward what you add, not what you copied. Because you now understand the schema and the cart-to-order flow, here are natural extensions you can build and explain:
- Search and filters: let users search products by name and filter by category or price range.
- Stock control: reduce stock when an order is placed and hide out-of-stock items.
- Order tracking: a page where customers see their past orders and status, using a
JOINacross orders and order_items. - Wishlist: let logged-in users save products for later.
- Ratings and reviews: a reviews table linked to products and users, with an average rating per product.
Each is a small, well-scoped addition that demonstrates real understanding, exactly what turns a standard download into a project you can defend and be proud of.
Frequently asked questions
What is an online shopping portal in PHP?
It is a multi-category online store web application built with PHP and MySQL, with a category-organized product catalog, shopping cart, checkout, orders, and an admin panel. It is a popular student project because it covers database design, sessions, authentication, and the full cart-to-order flow.
What database tables does it use?
The core schema has categories, products (each linked to a category), users, orders, and order_items (the line items inside each order). The category link makes it a multi-category portal, and the orders/order_items pair is the standard e-commerce structure.
How does the shopping cart work in PHP?
The cart is stored in a PHP session as an array of product IDs and quantities, so it persists across pages during the visit. At checkout, the session cart becomes permanent order and order_items records, then is cleared.
Can I use this as my college or university project?
Yes. It is well suited as an academic project, and because this guide explains the database design, the cart, and the checkout flow, you can confidently answer questions in a viva. Adding one of the suggested extensions makes it stronger still.
Is the source code free to download?
Yes, the full online shopping portal source code is available to download for free using the link in the download section above.
Download Online Shopping Portal in HTML, PHP, and MySQL – Free E-Commerce Website Project
The Online Shopping Portal is a complete e-commerce website developed using HTML, PHP, and MySQL. It is designed to showcase and sell household items to customers through a fully functional online platform. In today’s fast-paced digital world, online shopping has become an essential part of everyday life. With e-commerce platforms growing at an unprecedented rate, there is an increasing demand for robust and user-friendly online stores. This project delivers all the fundamental features needed for a professional online shopping website.
Built by Toseef Tariq, this project provides a responsive and attractive user interface where customers can browse products, add them to their cart, and make purchases from the comfort of their homes. It eliminates the need for physical store visits, offering a seamless online shopping experience. With HTML for structure, PHP for server-side scripting, and MySQL for database management, the portal combines modern web technologies to deliver efficiency and reliability.
What is the Online Shopping Portal Project?
The Online Shopping Portal is an e-commerce web application that allows customers to purchase household items online. It provides essential features such as product listings, user authentication, a shopping cart system, order tracking, and multiple checkout options. The primary aim is to provide customers with a safe, convenient, and hassle-free way to shop online.
By studying this project, beginners and students can learn how to integrate HTML, PHP, and MySQL into a fully functional web application. It demonstrates how to connect a front-end design with a back-end database, how to implement secure login systems, and how to handle product management and order tracking efficiently.
Key Features of the Online Shopping Portal in PHP
Login System with Password Protection
The project comes with a secure login system that ensures only registered users can access their accounts and place orders. Passwords are stored securely, adding an essential layer of security to user data.
Add New Products with Images and Details
Admins can easily add new household items to the online store. Each product includes a name, image, description, and price. This feature allows for quick updates to the product catalog without any complex coding.
Multiple Checkout Methods
The portal supports different payment methods, giving customers flexibility during checkout. Whether they want to pay via credit card, debit card, or other supported methods, the process is smooth and user-friendly.
Order Tracking System
Customers can track the status of their orders in real time. This feature improves transparency and ensures customers are informed about delivery progress.
Order History
Registered users can access their order history to view previous purchases. This helps customers reorder items easily and track their buying patterns.
Product Search Functionality
A built-in search feature allows customers to quickly find products they are looking for without scrolling through the entire catalog. This saves time and enhances user experience.
Why This Project is Important in Today’s E-Commerce Industry
With the rise of e-commerce giants, having a personal or small-scale online store is more important than ever for local businesses. This project is a great learning resource for students and developers who want to understand how e-commerce platforms work.
E-commerce websites built using PHP and MySQL are still widely used because they are lightweight, cost-effective, and easy to customize. Learning how to build such a project provides valuable skills in:
- PHP server-side scripting
- MySQL database design and management
- Product management systems
- User authentication and data security
- Search and filter functionality
For students, it’s an excellent portfolio project. For small business owners, it can be the foundation of an affordable online shop.
Installation Guide for Online Shopping Portal
Step 1: Download and Install XAMPP or WAMP Server
Since the project is developed using PHP and MySQL, you will need a local server environment to run it. Install either XAMPP or WAMP on your computer.
Step 2: Download the Project Files
Save the ZIP file of the Online Shopping Portal project to your computer.
Step 3: Extract the ZIP File
Use WinRAR or 7Zip to unzip the downloaded file.
Step 4: Move Project Files to Server Folder
Copy the extracted project folder to the “C:/wamp/www/” directory if using WAMP, or “C:/xampp/htdocs/” if using XAMPP.
Step 5: Import the Database
Open phpMyAdmin from your local server control panel. Create a new database and import the shopping.sql file provided in the project folder.
Step 6: Run the Project in Your Browser
In your browser, type:
localhost/online-shop-portal-php
The website will load, and you can start exploring its features.
How the Online Shopping Portal Works
When a user visits the website, they can browse a list of household products displayed with images and details. The customer can add products to their cart, select a checkout method, and confirm the order. All data — including customer details, orders, and product inventory — is stored in the MySQL database.
Admins can log in to the backend to add new products, update prices, and manage orders. The system also records all previous orders, allowing customers to check their order history. The search feature ensures quick product discovery, and the order tracking system keeps customers updated about their deliveries.
High CPC and SEO-Friendly Keywords You Can Target
To maximize traffic and AdSense revenue, here are relevant high-value keywords integrated into this post:
- Online shopping website PHP MySQL
- E-commerce website PHP project download
- Shopping cart PHP MySQL source code
- Build e-commerce website in PHP and MySQL
- PHP MySQL online store script free download
- Household items e-commerce website project
- PHP MySQL shopping portal with source code
- Online shop website PHP MySQL tutorial
Download the Online Shopping Portal Project in PHP, MySQL, and HTML
This project is a ready-to-use, feature-rich e-commerce website script that can be run on your local server or adapted for live hosting. It’s perfect for students looking for a final-year project, beginners learning PHP and MySQL, and small businesses exploring online sales solutions.
Download it today, set it up with XAMPP or WAMP, and start exploring the possibilities of building and running your own online shopping platform.
Final Thoughts
The Online Shopping Portal project in HTML, PHP, and MySQL is a complete, functional e-commerce solution for selling household items online. It has all the essential features of a modern online store — from secure logins and product listings to order tracking and multiple checkout options.
Whether you are a student learning web development, a developer looking to practice PHP and MySQL integration, or a business owner wanting to move your store online, this project provides a solid foundation. With its easy installation process and customizable code, you can modify it to suit your requirements and expand its features as needed.

