04-10-2011, 11:07 AM
|
#3 (permalink)
|
|
The Acquainted
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
|
Quote:
Originally Posted by pepelepew1962
Hello:
I am trying to create an appointment table and am having problems. I have a loading facility that I need to create an appointment book for. The theory is simple, but where I am having problems is creating a loop for adding to the table. Basically I need a to create a form where I enter the start date, start time along with end date and end time. Let's say the facility loads every day and has hourly appointments starting at 0700 hrs and ends at 1800 hrs. I would like to enter the start date, let's say April 01, 2011 and end date of September 1, 2011. Loop and create records of each date with the hour. Can anyone help me with this please. I have included a sample of the output in my mysql table:
tblName02
04/01/2011 07:00:00
04/01/2011 08:00:00
04/01/2011 09:00:00
04/01/2011 10:00:00
04/01/2011 11:00:00
04/01/2011 12:00:00
04/01/2011 13:00:00
04/01/2011 14:00:00
04/01/2011 15:00:00
04/01/2011 16:00:00
04/01/2011 17:00:00
04/01/2011 18:00:00
04/02/2011 07:00:00
04/02/2011 08:00:00
...
|
Would an easier way to be use 2 tables or maybe 3..
tbl1
id | ddate
1 | 04/01/2011
2 | 04/02/2011
etc ....
tbl2
id | ttime
1 | 07:00:00
2 | 08:00:00
3 | 09:00:00
4 | 10:00:00
5 | 11:00:00
6 | 12:00:00
7 | 13:00:00
8 | 14:00:00
9 | 15:00:00
10 | 16:00:00
11 | 17:00:00
12 | 18:00:00
You can itterate through the tables to get the listings you want..
Now a third table
tbl3
id | id_ddate | id_ttime | details
1 | 1 | 4 | details of appt
etc...
so using sql grabbing the data you need should be a breeze..
__________________
Thanks... Simon
Sex, Drugs & Linux Rules
|
|
|