appointment connected to the database

the appointment function is connected to the database
updates in appointment

corrected function in appointment. fully functional now