100% found this document useful (1 vote)
258 views

Project File

1. The document describes the requirements for a concert ticket booking project using Python and MySQL. It outlines the database structure, tables, sample Python code for performing CRUD operations, and a flow for the user interface. 2. The database schema includes tables for seat choices and payments, with sample data. The Python code contains functions for displaying, inserting, updating, and deleting records from these tables. 3. The user interface provides a menu to view bookings, make a new booking, update or cancel an existing booking, and exit. Sample outputs for these options are also provided.

Uploaded by

Ayyub Moideen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
258 views

Project File

1. The document describes the requirements for a concert ticket booking project using Python and MySQL. It outlines the database structure, tables, sample Python code for performing CRUD operations, and a flow for the user interface. 2. The database schema includes tables for seat choices and payments, with sample data. The Python code contains functions for displaying, inserting, updating, and deleting records from these tables. 3. The user interface provides a menu to view bookings, make a new booking, update or cancel an existing booking, and exit. Sample outputs for these options are also provided.

Uploaded by

Ayyub Moideen
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Synopsis

Concert is an open arena where your favourite artists perform live. It is


an amazing and mind blowing experience. There is live interaction with
band members and fans. We can book seats beforehand without any
hustle or standing in long queues and get the preferred seats.
1.Ticket Extraordinaire is the fastest and simplest site to book tickets for
your favourite concerts. We provide our customers easiest way of
booking tickets without any confusions and avoid any complications.
The details of the customers through email.

2. We provide with the latest concert dates and offer best seats with the
best prices.
3. If the customer wants to make changes in their booking details and
wants to replace with new information, they can choose update option.
The details can be updated by entering their mobile number.
4. The customer can only cancel their booked seats two week before the
event, after will not be accepted.
5. Any queries regarding the booking, we have customer service to help
you out.

We will be preparing our project in the above given matter.

Project Requirements

1|Page
1.Python
2.MySQL

2|Page
RDBMS
DBMS : MySQL
Host : localhost
User : root
Password : mysql
Database : info

Table Structures :
3|Page
Table : Seatchoice

Table : Payment

4|Page
5|Page
Python Code

6|Page
import mysql.connector
import pandas as pd

mydb=mysql.connector.connect(host="localhost",user="root",pa
sswd="mysql",database="info");
def displayseatchoice():
try:
mydb=mysql.connector.connect(host="localhost",
user ="root",passwd="mysql",database="info")
cur=mydb.cursor()
cur.execute("select * from seatchoice")
ab=cur.fetchall()
bc=cur.rowcount
for i in ab:
NumberofTickets=i[0]
Price=i[1]
Section=i[2]
ConName=i[3]
Seats=i[4]
AmtPaid=i[5]
print('(NumberofTickets=%s,Price=
%s,Section="%s",ConName="%s",Seats=%s,AmtPaid=
%s)'%
(NumberofTickets,Price,Section,ConName,Seats,AmtPa
id))
print("Number of Records Fetched:",bc)
print()
except:
print("Error")
mydb.close()

7|Page
def insertseatchoice():
print()
print('''1.BTS Concert
2.Event Rebel
3.FestiVista
4.Acapella Events''')
print()
Conc=input("enter concert name:")
NumberofTickets=int(input("enter number of tickets:"))
Price=int(input("enter price of ticket:"))
Section=input("enter section:")
Seats=int(input("enter number of seats:"))
AP=NumberofTickets*Price
try:
mydb=mysql.connector.connect(host="localhost",
user="root",passwd="mysql",database="info")
cur=mydb.cursor()
cur.execute("insert into seatchoice values(%s,
%s,'%s','%s',%s,%s)"%(NumberofTickets,
Price,Section,Conc,Seats,AP))
mydb.commit()
print("record inserted successfully")
print()
except:
print("Error")
mydb.rollback()
mydb.close()

def seatchoice():
8|Page
print('----------------------------------')
print("*Welcome to Ticket Extraordinaire*")
print('----------------------------------')
print("1. Search for a seat")
print("2. New seat")
print()
ch=int(input("enter your choice:"))
if ch==1:
seatchoice()
c=int(input("Enter your choice:"))
if c==1:
displayseatchoice()
elif c==2:
insertseatchoice()
print()
else:
hp=input("Do you want to exit(Y/N)")
if hp=="Y":
print("Done")
print()
else:
seatchoice()

def displaypayment():
try:
mydb=mysql.connector.connect(host="localhost",
9|Page
user="root",passwd="mysql",database="info")
cur=mydb.cursor()
cur.execute("select * from payment")
records=[i[0:] for i in cur.fetchall()]
count=cur.rowcount
print("Number of Records Fetched:",count)
print()
df=pd.DataFrame(records,columns=["FirstName","LastName","
MobileNumber","EmailId","BankId","DebitorCredit"])
print(df)
print()
except:
mydb.close()

def insertpayment():
print()
FirstName=input("enter your first name:")
LastName=input("enter your last name:")
MobileNumber=int(input("enter your mobile number:"))

10 | P a g e
EmailId=input("enter your email id:")
BankId=input("enter your bank id:")
DebitorCredit=input("enter (debit or credit):")
try:
mydb=mysql.connector.connect(host="localhost",
user="root",passwd="mysql",database="info")
cur=mydb.cursor()
cur.execute("Insert into payment values('%s','%s',%s,'%s',
%s,'%s')"%
(FirstName,LastName,MobileNumber,EmailId,BankId,Debit
orCredit))
mydb.commit()
print("record inserted successfully")
print()
print('-----------------------------')
print('Booking Information Confirmed')
print('-----------------------------')
print()
except:
mydb.rollback()
mydb.close()

def updatepayment():
try :
mydb=mysql.connector.connect(host="localhost",
user="root",passwd="mysql",database="info")
cur=mydb.cursor()

11 | P a g e
updt=input("are you sure you want to change any
information(y/n):")
print()
if updt=='y' or updt=='Y':
print()
tel=int(input('enter mobile number to update:'))
fn=input('enter updated first name:')
ln=input('enter updated last name:')
ed=input('enter updated email id:')
bd=input('enter updated bank id:')
debcre=input('enter updated debitorcredit:')
cur.execute("update payment set
FirstName='%s',LastName='%s',EmailId='%s',BankId='
%s',DebitorCredit='%s' where MobileNumber=%s"%
(fn,ln,ed,bd,debcre,tel))
mydb.commit()
print('----------------------------')
print("Details Updated Successfully")
print('----------------------------')
print()
except:
mydb.rollback()
mydb.close()

def deletepayment():
try:
mydb=mysql.connector.connect(host="localhost",
user="root",passwd="mysql",database="info")
cur=mydb.cursor()
updt=input("are you sure you want to cancel the
booking(y/n):")
12 | P a g e
if updt=='y' or updt=='Y':
print()
tel=int(input('enter mobile number to delete:'))
cur.execute("delete from payment where
MobileNumber=%s"%(tel))
mydb.commit()
print('-------------------------------')
print("Booking Cancelled Successfully")
print('-------------------------------')
print()
except:
mydb.rollback()
mydb.close()

'''def payment():
print("1.Payment")
print("2.Buy Ticket")
hc=int(input("enter your choice:"))
if hc==1:
#payment()'''

def concert():

13 | P a g e
d=pd.read_csv(r"D:\conc.csv")
df=pd.DataFrame(d)
print(df)
while True:
print("1.Display Payment")
print("2.Buy Ticket")
print("3.Update Payment Details")
print("4.Cancel Booking")
print("5.Exit")
print()
p=int(input("Enter your choice:"))
if p==1:
displaypayment()
elif p==2:
insertpayment()
elif p==3:
updatepayment()
elif p==4:
deletepayment()
else:
ph=input("Do you want to exit(Y/N)")
if ph=="Y" or ph=="y":
print()
print('--------------------------------------------------')
print('**Thank You for booking in Ticket
Extraordinaire**')
print('--------------------------------------------------')
print()
concert()
print("Done")

14 | P a g e
break

15 | P a g e
Output

To Display Details of Booking

16 | P a g e
To Insert Details of Booking

17 | P a g e
To Update Details of Booking

To Delete Details of Booking

18 | P a g e
To Exit the Booking

19 | P a g e

You might also like