Download as pdf or txt
Download as pdf or txt
You are on page 1of 5

Project On “SPORTS CLUB”

By:
KAMLESH KUMAR RAJAK (PGT CS) K V DAMOH (Jabapur Region)
SANJEEV SONI KV DHANA(Jabapur Region)
DBMS: MySQL
Host : localhost
User: root
Pass: ip
DataBase: sports
Table name -club
Table Structure: (Images Bellow)
Python Code:
import os
import platform
import mysql.connector
import pandas as pd

mydb=mysql.connector.connect(host="localhost",\
user="root",\
passwd="ip",\
database="sports")
mycursor=mydb.cursor()

def RegisterClub():
L=[]
enroll=int(input("Enter the registration number(Max 5 Digits) : "))
L.append(enroll)

sname=input("Enter the Name of club member: ")


L.append(sname)
age=int(input("Enter Age of member : "))
L.append(age)
city=input("Enter the City of the member : ")
L.append(city)
sportname=input("Enter the sport name : ")
L.append(sportname)
phone=input("Enter Phone number in Digits : ")
L.append(phone)
address=input("Enter Address of member : ")
L.append(address)

regfee=int(input("Enter the registration Fee : "))


L.append(regfee)
value=L
sql="insert into club (enroll,sname,age,city,class,phone,address,regfee) values
(%s,%s,%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,value)
mydb.commit()

def ClubView():
print("Select the search criteria : ")
print("1. Enroll")
print("2. Name")
print("3. Age")
print("4. City")

print("5. phone")
print("6. Address")
print("7. All")
ch=int(input("Enter the choice : "))
if ch==1:
s=int(input("Enter enroll no : "))
rl=(s,)
sql="select * from club where enroll=%s"
mycursor.execute(sql,rl)
elif ch==2:
s=input("Enter Name : ")
rl=(s,)
sql="select * from club where sname=%s"
mycursor.execute(sql,rl)
elif ch==3:
s=int(input("Enter age : "))
rl=(s,)
sql="select * from club where age=%s"
mycursor.execute(sql,rl)
elif ch==4:
s=input("Enter City : ")
rl=(s,)
sql="select * from club where City=%s"
mycursor.execute(sql,rl)
elif ch==5:

s=input("Enter phone : ")


rl=(s,)
sql="select * from club where phone=%s"
mycursor.execute(sql,rl)

elif ch==6:
s=input("Enter address : ")
rl=(s,)
sql="select * from club where address=%s"
mycursor.execute(sql,rl)
elif ch==7:
sql="select * from club"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The Memebers details are as follows : ")
print("(ROll, Name, Age, Class, City)")
for x in res:

print(x)

def SearchClub():
print("Please enter the details to view the fee details :")

enroll=int(input("Enter the enroll number of the member whose fee is to be viewed : "))
sql="Select * from club where enroll=%s"
rl=(enroll,)

mycursor.execute(sql,rl)
res=mycursor.fetchall()
if res==None:
print("Record not Found . . . ")

return
print("The details of the memebrs are : " )
for x in res:
print(x)

def RemoveClub():
enroll=int(input("Enter the enroll number of the memeber to be deleted : "))
rl=(enroll,)
sql="Delete from club where enroll=%s"
mycursor.execute(sql,rl)
mydb.commit()

def MenuSet(): #Function For The Memeber Management System


print("Enter 1 : To Register Club")
print("Enter 2 : To View Club ")
print("Enter 3 : To Search Club ")
print("Enter 4 : To Remove Club")

# try: #Using Exceptions For Validation

userInput = int(input("Please Select An Above Option: ")) #Will Take Input From User except
ValueError:
# exit("\nHy! That's Not A Number") #Error Message

# finally:
print("\n") #Print New Line
if(userInput == 1):
RegisterClub()
elif (userInput==2):
ClubView()
elif (userInput==3):
SearchClub()
elif (userInput==4):
RemoveClub()
else:
print("Enter correct choice. . . ")
def runAgain():

runAgn = input("\nwant To Run Again Y/n: ")


while(runAgn.lower() == 'y'):
if(platform.system() == "Windows"):
print(os.system('cls'))
else:
print(os.system('clear'))
MenuSet()
MenuSet()
runAgain()

You might also like