I have a calendar and a time

i used jquery date picker for the calendar
and a simple select box for the time

how can i disable both date and time dynamically?
for the time when the time is already booked in a date
it will be remove in the select box for that specific date only

and for the date when all the time is fully booked for the date
the specific date will be disabled.

i will be using php and mysql for storing data
also is having a database for example
db_calendar
(table)dates
(column)date
(column)time

is it enough to create the functionality i want?