Passengers Project
Passengers Project
Passengers Project
connector as x
con=x.connect(host='localhost',user='root',passwd='root',database='railwaymanagement')
cur=con.cursor()
def Addnewrecord():
if ch in 'Y,y':
con.commit()
else:
def DisplayAll():
data=cur.fetchall()
print(tabulate(data,headers=['PassengerName','PassengerAge','PassengerGender','TrainName','TrainNo','
DepartureFrom','ArrivalTo','Date','Day','TimeOfDeparture','TicketNo'],tablefmt='grid'))
def Search():
data=cur.fetchall()
if data==None:
else:
print(tabulate(data,headers=['PassengerName','PassengerAge','PassengerGender','TrainName','TrainNo','
DepartureFrom','ArrivalTo','Date','Day','TimeOfDeparture','TicketNo'],tablefmt='grid'))
def Delete():
data=cur.fetchall()
if data==None:
else:
print(tabulate(data,headers=['PassengerName','PassengerAge','PassengerGender','TrainName','TrainNo','
DepartureFrom','ArrivalTo','Date','Day','TimeOfDeparture','TicketNo'],tablefmt='grid'))
if ch in 'Y,y':
con.commit()
else:
def Modify():
data=cur.fetchall()
if data==None:
else:
print(tabulate(data,headers=['PassengerName','PassengerAge','PassengerGender','TrainName','TrainNo','
DepartureFrom','ArrivalTo','Date','Day','TimeOfDeparture','TicketNo'],tablefmt='grid'))
if ch in 'Y,y':
if PassengerName!='':
con.commit()
if PassengerAge!='':
con.commit()
if PassengerGender!='':
con.commit()
if TrainName!='':
con.commit()
if TrainNo!='':
con.commit()
con.commit()
if ArrivalTo!='':
con.commit()
if Date!='':
con.commit()
if Day!='':
con.commit()
if TimeOfDeparture!='':
con.commit()
else:
while True:
print("6.EXIT.")
Addnewrecord()
elif ch==2:
DisplayAll()
elif ch==3:
Search()
elif ch==4:
Delete()
elif ch==5:
Modify()
elif ch==6:
break