TABLE OF CONTENTS
[Link] TOPIC [Link]
1 ABSTRACT 2
2 INTRODUCTION 4
3 HARDWARE & SOFTWARE 5
REQUIREMENTS
4 PROPOSED SYSTEM 7
5 MODULE DESCRIPTION 10
6 DATABASE & tABLES 11
7 SOURCE CODE 15
8 OUTPUT 25
9 CONCLUSION 30
10 BIBLIOGRAPHY 31
1
ABSTRACT
The Food Ordering Portal is a console-based application developed using Python and MySQL
that automates the process of managing food items and customer orders. The system provides an
interactive platform where administrators can manage food menus while customers can view
available food items and place multiple orders in a single transaction. This project demonstrates
effective database connectivity using PyMySQL and real-time data handling.
In traditional food ordering systems, manual order processing often leads to errors in billing,
record maintenance, and time management. This project aims to overcome these limitations by
introducing an automated solution that ensures accuracy, efficiency, and consistency. The
application dynamically calculates item-wise totals and generates a consolidated bill for
customers.
The Food Ordering Portal is designed with simplicity and clarity, making it suitable for
beginners learning Python-MySQL integration. It serves as a practical implementation of
database operations such as insertion, retrieval, updating, and transaction handling, thereby
bridging the gap between theoretical concepts and real-world applications.
2
INTRODUCTION
3
INTRODUCTION
The rapid growth of the food service industry has increased the demand for efficient and reliable
order management systems. Manual systems are time-consuming and prone to calculation errors,
especially when handling multiple food items and customers. Automation plays a crucial role in
improving service quality and operational efficiency.
This project focuses on developing a simple yet powerful food ordering system using Python
programming language and MySQL as the backend database. Python is chosen due to its
simplicity and wide support for database connectivity, while MySQL ensures secure and
structured data storage.
The Food Ordering Portal allows administrators to control food inventory and pricing, while
customers can easily browse food items and place orders. The system ensures accurate billing by
calculating totals automatically based on quantity and price, making it an ideal solution for small
restaurants and educational purposes.
4
HARDWARE AND SOFTWARE REQUIREMENTS
Hardware Requirements
Processor: Intel i3 or higher
RAM: Minimum 4 GB
Hard Disk: 10 GB free space
Input Devices: Keyboard, Mouse
Software Requirements
Operating System: Windows 10
Programming Language: Python 3.x
Database: MySQL Server
IDE: IDLE
Python Library: PyMySQL
5
PROPOSED
SYSTEM
6
PROPOSED SYSTEM
The proposed system is a computerized food ordering portal that eliminates the drawbacks of
manual order processing. It provides a structured approach to manage food items, customer
orders, and billing operations through a centralized database.
The system introduces role-based access where the administrator is responsible for managing
food items, including adding new items, viewing existing items, and updating prices. This
ensures better control over the food inventory and pricing consistency.
Customers can view the food menu categorized into Veg and Non-Veg items and place orders
for multiple food items in a single session. The system calculates individual item totals and
generates a final bill with a grand total, reducing human errors and improving customer
satisfaction.
Overall, the proposed system enhances efficiency, accuracy, and data management while
providing a user-friendly interface suitable for both learning and practical implementation.
7
IMPORTANCE OF PYTHON AND MYSQL
Python is a powerful and easy-to-learn programming language widely used for
application development. Its simple syntax makes the code readable and easy to
maintain, even for beginners.
Python provides strong support for database connectivity through libraries like
PyMySQL, which makes it easy to interact with MySQL databases.
MySQL is a popular relational database management system known for its
reliability, performance, and security. It efficiently stores large volumes of
structured data.
Using Python with MySQL allows developers to build scalable and data-driven
applications. The combination is widely used in real-world software systems.
Together, Python and MySQL provide a cost-effective and efficient solution for
developing management systems like this Hotel Management System
8
MODULE
DESCRIPTION
DATABASE
&
TABLES
9
MODULE DESCRIPTION
Admin Module
This module allows the administrator to log in securely using credentials stored in the database.
The admin can add new food items, view all available food items, and update food prices as
required.
Food Management Module
This module handles all food-related operations such as storing food name, category (Veg/Non-
Veg), and price. It ensures that food data is accurately maintained in the database.
Customer Order Module
The customer module enables users to view the food menu and place orders for multiple items.
Customers can specify quantities, and the system automatically calculates item-wise and total
billing amounts.
Billing Module
This module generates the final bill by summing the total cost of all ordered food items. It
displays a clear and detailed bill including item name, quantity, price, and grand total.
10
DATABASE AND TABLES
Database Name: food_portal
Admin Table
Stores administrator login credentials.
admin_id (Primary Key)
username
password
Food Items Table
Stores details of food items available in the portal.
food_id (Primary Key)
food_name
category (Veg / Non-Veg)
price
Orders Table
Stores customer order details.
order_id (Primary Key)
food_id (Foreign Key)
quantity
total_price
order_date
11
CREATE DATABASE
USE DATABASE
SHOW TABLES
ADMIN TABLE
12
INSERT ADMIN CREDENTIALS
FOOD ITEMS TABLE
ORDER TABLE
13
SOURCE CODE
14
import pymysql
from datetime import datetime
# ---------------- DATABASE CONNECTION ----------------
def db_connect():
return [Link](
host="localhost",
user="root",
password="root", # change if you have password
database="food_portal"
)
# ---------------- ADMIN LOGIN ----------------
def admin_login():
con = db_connect()
cur = [Link]()
username = input("Enter Admin Username: ")
password = input("Enter Admin Password: ")
15
query = "SELECT * FROM admin WHERE username=%s
AND password=%s"
[Link](query, (username, password))
if [Link]():
print("\n Admin Login Successful")
admin_menu()
else:
print("\n❌ Invalid Credentials")
[Link]()
# ---------------- ADD FOOD ITEM ----------------
def add_food():
con = db_connect()
cur = [Link]()
name = input("Food Name: ")
16
category = input("Category (Veg/Non-Veg): ")
price = float(input("Price: "))
query = "INSERT INTO food_items(food_name, category,
price) VALUES (%s,%s,%s)"
[Link](query, (name, category, price))
[Link]()
print(" Food Item Added Successfully")
[Link]()
# ---------------- VIEW FOOD ITEMS ----------------
def view_food():
con = db_connect()
cur = [Link]()
[Link]("SELECT * FROM food_items")
foods = [Link]()
17
print("\n--- FOOD MENU ---")
print("ID | Name | Category | Price")
print("-" * 40)
for f in foods:
print(f"{f[0]} | {f[1]} | {f[2]} | ₹{f[3]}")
[Link]()
# ---------------- UPDATE FOOD ITEM ----------------
def update_food():
con = db_connect()
cur = [Link]()
food_id = int(input("Enter Food ID to Update: "))
new_price = float(input("Enter New Price: "))
query = "UPDATE food_items SET price=%s WHERE
food_id=%s"
18
[Link](query, (new_price, food_id))
[Link]()
print(" Food Price Updated")
[Link]()
# ---------------- CUSTOMER ORDER ----------------
def customer_order():
con = db_connect()
cur = [Link]()
grand_total = 0
order_items = []
while True:
view_food()
food_id = int(input("\nEnter Food ID to Order: "))
quantity = int(input("Enter Quantity: "))
19
[Link]("SELECT food_name, price FROM
food_items WHERE food_id=%s", (food_id,))
food = [Link]()
if food:
food_name = food[0]
price = food[1]
total = price * quantity
grand_total += total
order_items.append((food_name, quantity, price, total))
query = """
INSERT INTO orders(food_id, quantity, total_price,
order_date)
VALUES (%s,%s,%s,%s)
"""
[Link](query, (food_id, quantity, total,
[Link]()))
20
[Link]()
else:
print("Invalid Food ID")
choice = input("Add more items? (yes/no): ").lower()
if choice != "yes":
break
print("\n FINAL BILL")
print("-" * 50)
print("Item\tQty\tPrice\tTotal")
for item in order_items:
print(f"{item[0]}\t{item[1]}\t₹{item[2]}\t₹{item[3]}")
print("-" * 50)
print("GRAND TOTAL: ₹", grand_total)
21
[Link]()
# ---------------- ADMIN MENU ----------------
def admin_menu():
while True:
print("\n--- ADMIN MENU ---")
print("1. Add Food Item")
print("2. View Food Items")
print("3. Update Food Item Price")
print("4. Exit")
choice = input("Enter Choice: ")
if choice == "1":
add_food()
elif choice == "2":
view_food()
elif choice == "3":
22
update_food()
elif choice == "4":
break
else:
print("Invalid Choice")
# ---------------- MAIN MENU ----------------
def main():
while True:
print("\n=== FOOD PORTAL SYSTEM ===")
print("1. Admin Login")
print("2. Customer Order")
print("3. Exit")
choice = input("Enter Choice: ")
if choice == "1":
admin_login()
elif choice == "2":
23
customer_order()
elif choice == "3":
print("Thank You 😊")
break
else:
print("Invalid Choice")
main()
24
OUTPUT
25
FOOD PORTAL
ADMIN PORTAL
ADD FOOD
VIEW FOOD
26
UPDATE FOOD
FOOD PORTAL EXIT
ADMIN EXIT
27
CUSTOMER ORDER & BIILING
28
CONCLUSION
&
BIBLIOGRAPHY
29
CONCLUSION
The Food Ordering Portal successfully demonstrates the integration of Python with MySQL to
build a functional database-driven application. The system automates food ordering and billing
processes, reducing manual effort and improving accuracy.
The project provides a clear understanding of CRUD operations, database connectivity, and
modular programming. It serves as an excellent learning tool for students and beginners
exploring real-time database applications.
Overall, the application fulfills its objectives by offering a reliable, efficient, and user-friendly
solution for food order management while maintaining data consistency and integrity.
FUTURE ENHANCEMENTS
Add customer details such as name and phone number
Generate invoice numbers for each order
Implement user authentication for customers
Develop a graphical user interface (GUI)
Integrate online payment options
Add sales reports and analytics
30
BIBLIOGRAPHY
1. Python Official Documentation – [Link]
2. MySQL Official Documentation – [Link]
3. PyMySQL Documentation – [Link]
4. Greeks for Greeks
5. Database System Concepts by Silberschatz
31