Cs Project
Cs Project
connector as mycon
# Database Connection
# MAIN MENU
def showmenu():
while True:
print("*" * 50)
print("*" * 50)
print("6 - Exit")
print("*" * 50)
if choice == 1:
addPatient()
elif choice == 2:
viewPatients()
elif choice == 3:
viewAppointments()
elif choice == 4:
addDoctor()
elif choice == 5:
viewDoctors()
elif choice == 6:
print("*" * 50)
print("*" * 50)
break
def addPatient():
q = "INSERT INTO patients (pname, age, gender, contact, diagnosis, room_no) VALUES ('{}', {}, '{}',
'{}', '{}', {})".format(pname, age, gender, contact, diagnosis, room_no)
cr1 = con.cursor()
cr1.execute(q)
con.commit()
def viewPatients():
cr1 = con.cursor()
cr1.execute(q)
res = cr1.fetchall()
if res == []:
else:
print(row)
# View Appointments
def viewAppointments():
cr1 = con.cursor()
cr1.execute(q)
res = cr1.fetchall()
if res == []:
else:
print(row)
# Add Doctor
def addDoctor():
q = "INSERT INTO doctors (dname, specialty, contact) VALUES ('{}', '{}', '{}')".format(dname,
specialty, contact)
cr1 = con.cursor()
cr1.execute(q)
con.commit()
# View Doctors
def viewDoctors():
cr1 = con.cursor()
cr1.execute(q)
res = cr1.fetchall()
if res == []:
else:
print(row)
if con.is_connected():
showmenu()