Hi there,
From marketing point of view, it is not recommended that you show all the tables available for the customers to "try to" reserve even if some of them have already been reserved by then - why not show them as "Reserved" or don't show the reserved tables at all? It's a little dissapointing to find out AFTER entering my c_id that the table had been already reserved...
If you have [Customer] +-< [Reservation] >-+ [Table] , I assume that there is going to be NO t_num in Reservation on any given day unless a customer books it with his/her c_id within that day. If this is the case, you need to look for t_num that does NOT have an entry in Reservation for today. In that case, if you build an SQL like this:
You can retrieve those tables that do not have entries in Reservation for today, which means they are available for reservation for today.
HOWEVER, in the above example, I used subquery, which I thought would only work on MySQL 4.1 or later.
If your MySQL is older than that, then you can split them into two SQL and compare the output after retrieving them with PHP or something. There may be a single query to retrieve what you want without subquery, but it's 5:00 in the morn where I am and I can't think straight right now.
One more thing - if you need to show all the tables anyway and then the avilability, simply use the subquery (the one in the brackets after "NOT IN"). This will get you all the table IDs (t_num) that are RESERVED for tonight. Put these into an array and show the availability by examining each table ID to see if it exists in the array (i.e. use in_array() or something).
This should (I did not test it at all.. sorry!) output HTML rows whose 1st column contain table ID and the 2nd if available or not.
Hope this helps. Good night. =)