Project
Project
Gurucharan R
CONTENTS
1. Bonafide Certificate ~3
2. Acknowledgement ~4
3. Case Study ~5
4. Software Used ~6
5. Operating Instructions ~7
6. Code ~8
7. Table Description ~13
8. Output ~ 14
9. Scope For Improvement ~ 19
10. Bibliography ~ 20
CERTIFICATE
_______________ _______________
Mrs. Shakunthala External Examiner
Computer Science
Teacher
_______________________
I would like to thank our School Management and our Principal, Vice-Principal
and the coordinators who have made every single effort to provide a full-
ideas about different kinds of projects and also explaining various means of
developing the project which could culminate into a project report. I would like
The program contains two portals (Admin and Student). A student can view
his/her order details in the Student portal using his/her roll number.
The student can also give an exchange request to the admin.
Admin should enter the password to gain access to student data through
Admin Portal. After that the admin can input, view, update student details,
update delivered status and view exchange requests.
Software
~ Python 3.8.6
~ MySQL
Functions Used
Run the program installationstdmgm.py to setup the database for the first
time.
Student:
Admin:
import mysql.connector
db_connection = mysql.connector.connect(host="localhost",user="root",password="admin")
cursor = db_connection.cursor()
cursor.execute("create database stdmgm;")
cursor.execute("use stdmgm;")
cursor.execute("create table users (rollno int primary key, name varchar(30), std int, section char(1), email
varchar(30), shirtsize varchar(2), pantsize varchar(2), socksize int, delivered varchar(3));")
db_connection.commit()
cursor.execute("create table users_exchange (rollno int primary key, name varchar(30), std int, section
char(1), email varchar(30), reason varchar(50));")
print("Database and table created successfully.")
db_connection.commit()
cursor.close()
mainstdmgm.py
import mysql.connector
db_connection = mysql.connector.connect(host="localhost",user="root",password="admin",database="stdmgm")
def student_info():
def admin():
def insertinto():
cursor = db_connection.cursor()
rollno = int(input("Enter the rollno : "))
cursor.execute("select rollno from users where rollno = %s",(rollno,))
user_data = cursor.fetchone()
if user_data:
print("The order details for the roll number ",rollno," already exists. Use update option to update the details.")
else:
name = str(input("Enter the name : "))
std = int(input("Enter the standard : "))
section = str(input("Enter the section : "))
email = str(input("Enter the email : "))
shirtsize = str(input("Enter the shirt size (S / M / L / XL) : "))
pantsize = str(input("Enter the pant size (S / M / L / XL) : "))
socksize = int(input("Enter the socks size (6 / 8 / 10 / 12) : "))
delivered = "No"
insert_query = "insert into users (rollno, name, std, section, email, shirtsize, pantsize, socksize, delivered)
VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)"
user_data = (rollno, name, std, section, email, shirtsize, pantsize, socksize, delivered)
cursor.execute(insert_query, user_data)
db_connection.commit()
cursor.close()
def updateinto():
cursor = db_connection.cursor()
rollno = int(input("Enter the rollno of the student whose details you want to update: "))
select_query = "select rollno, name, std, section, email, shirtsize, pantsize, socksize, delivered FROM users
WHERE rollno = %s"
cursor.execute(select_query, (rollno,))
user_data = cursor.fetchone()
if user_data:
update_query = "update users set name = %s, std = %s, section = %s, email = %s, shirtsize = %s, pantsize
= %s, socksize = %s, delivered = %s where rollno = %s"
updated_user_data = (name, std, section, email, shirtsize, pantsize, socksize, delivered, rollno)
cursor.execute(update_query, updated_user_data)
db_connection.commit()
print("\nUser data updated successfully.")
else:
print("\nNo student details found with roll number",rollno)
db_connection.commit()
cursor.close()
def view():
cursor = db_connection.cursor()
rollno = input("Enter the rollno of the student you want to view: ")
select_query = "select * FROM users WHERE rollno = %s"
cursor.execute(select_query, (rollno,))
user_data = cursor.fetchone()
if user_data :
def deliveryout():
cursor = db_connection.cursor()
rollno = int(input("Enter the roll number of the student who got their uniform delivered: "))
update_query = "update users set delivered = 'Yes' WHERE rollno = %s"
cursor.execute(update_query, (rollno,))
db_connection.commit()
cursor.close()
print("\nRecord updated successfully!")
def exchange():
cursor = db_connection.cursor()
print("Exchange requests : ")
select_query = "select * from users_exchange"
cursor.execute(select_query)
user_data = cursor.fetchall()
for i in user_data :
print("Roll number : ", i[0])
print("Reason : ", i[5])
while True:
if option == 1:
insertinto()
elif option == 2:
updateinto()
elif option == 3:
view()
elif option == 4:
deliveryout()
elif option == 5:
exchange()
else:
break
break
else:
print("Wrong credentials ! Contact the Dev to reset the password.")
break
while True:
print()
print("-"*40)
userid=int(input("Enter '1' to log on to student portal \nEnter '2' to log on to admin portal \nTo exit enter '3'\n"))
print("-"*40)
if userid == 1:
student_info()
elif userid == 2:
admin()
elif userid == 3:
db_connection.close()
break
Table Description
Table: users
Table : users_exchange
Output
----------------------------------------
Enter '1' to log on to student portal
Enter '2' to log on to admin portal
To exit enter '3'
2
----------------------------------------
Enter the password : admin1234
Successfully logged into admin account...
----------------------------------------
1. Input New Student Details
2. Update Existing Student Details
3. View Existing Student Details
4. Delivery
5. Exchange requests
6. Exit
Enter the corresponding number to your choice : 1
----------------------------------------
Enter the rollno :1
Enter the name : Guru
Enter the standard : 12
Enter the section :A
Enter the email : [email protected]
Enter the shirt size (S / M / L / XL) : S
Enter the pant size (S / M / L / XL) : M
Enter the socks size (6 / 8 / 10 / 12) : 8
----------------------------------------
1. Input New Student Details
2. Update Existing Student Details
3. View Existing Student Details
4. Delivery
5. Exchange requests
6. Exit
Enter the corresponding number to your choice : 1
----------------------------------------
Enter the rollno :2
Enter the name : Charan
Enter the standard : 12
Enter the section :A
Enter the email : [email protected]
Enter the shirt size (S / M / L / XL) : M
Enter the pant size (S / M / L / XL) : M
Enter the socks size (6 / 8 / 10 / 12) : 10
----------------------------------------
1. Input New Student Details
2. Update Existing Student Details
3. View Existing Student Details
4. Delivery
5. Exchange requests
6. Exit
Enter the corresponding number to your choice : 2
----------------------------------------
Enter the rollno of the student whose details you want to update: 1
Existing Student Data:
Roll number : 1
Name : Guru
Standard : 12
Section : A
Email : [email protected]
Shirtsize : S
Pantsize : M
Socksize : 8
Delivery status : No
Enter the reason for your exchange request : Pant given is very loose. Need L sized pant.
----------------------------------------
Enter '1' to log on to student portal
Enter '2' to log on to admin portal
To exit enter '3'
1
----------------------------------------
Enter your roll number : 1
Your uniform isn't delivered. Please ask the admin to change the details.
----------------------------------------
Enter '1' to log on to student portal
Enter '2' to log on to admin portal
To exit enter '3'
2
----------------------------------------
Enter the password : admin1234
Successfully logged into admin account...
----------------------------------------
1. Input New Student Details
2. Update Existing Student Details
3. View Existing Student Details
4. Delivery
5. Exchange requests
6. Exit
Enter the corresponding number to your choice : 3
----------------------------------------
Enter the rollno of the student you want to view: 1
----------------------------------------
Enter '1' to log on to student portal
Enter '2' to log on to admin portal
To exit enter '3'
3
----------------------------------------
Scope for improvement
The student portal could have been improved with many more options.
Student’s details could have been secure because any one can access
their details through their roll number.
The admin can only update one record at a time which could have been
improved.
Could have integrated the project with Tkinter Module.
Bibliography
Programiz
https://www.programiz.com/python-programming/
Stack exchange
https://cs.stackexchange.com/