PrettyTable
unknown
python
13 days ago
729 B
1
Indexable
Never
def ShowUserAppointments(userid): cursor.execute(""" SELECT a.appointmentid, d.firstname, d.lastname, a.bookingdate, a.bookinghour FROM allappointments a INNER JOIN doctors d ON a.doctorid = d.id WHERE a.userid = %s""", (user_id,)) appointments = cursor.fetchall() if not appointments: print("No appointments found for this user.") else: table = PrettyTable() table.fieldnames = ["Appointment ID", "Doctor", "Date", "Hour"] for appointment in appointments: table.add_row([appointment[0], appointment[1] + ' ' + appointment[2], appointment[3], appointment[4]]) print("Your Appointments:") print(table)
Leave a Comment