Event Form setup help
Posted 03 May 2006 - 03:28 PM
With my site, you first have to register an account, then login to access the listing form. On the form (and in database) are the current fields:
month1, day1, time1, month2, day2, time2, month3, day3, time3, type, highlight, summary
The reason it is setup like month1, day1, month2, day2, month3, day3 is because it is tied in with a calendar that I setup. Which ever days are entered in the database for those fields show up on the calendar as highlighted days. That was the only way I could get it to work. It is working great now, but as I progress with my site I am finding things I would like to change.
I have seen other sites that set it up like this: Start Date, and then the Number of days the event is going on for (1-7).
I could leave it how it is, where the user has only 3 days available on the form, where they select the month, day, and time of each day of the event; but I thought it would be easier for the user to select the first day of the event (Start Date) and then choose how many days the event goes on for (1-7).
Would something like this be easy to do?
If it were possible, I then need to connect the new setup to my calendar. Right now I am storing the 3 days in my database, so it would be like this:
month1 = May, day1 = 3, month2 = May, day2 = 4
The reason why the month is printed is because the calendar array is setup January-December, and if an event is near the end of a month, it would display the event day on the correct calendar month.
Example: Someone posts an event for April 30th and May 1st, by using the month fields it will only show event listings on the same calendar month. If today was April 25th, then only the 30th would be highlighted on the calendar. May 1st would not be.
Originally I had it setup by day only, so in the example above, the 1st and 30th would be highlighted for the month of April. That would have caused alot of confusion for visitors.
I think I explained everything. Sorry about making it so long, I just wanted to include as much detail as possible. Let me know if you need more info.
Any help would be great.
Posted 03 May 2006 - 04:59 PM
You should have 2 tables:
That way you can tie as many dates and times to an event as you need to.
Next, I'm going to tell you that what you want is possible and all you really need to do is then record the first date and time and the duration. In that case, you'd only use one table.
When you display the calendar, you're just going to have to do a little math to figure out how many days to go and what their date and time will be.
I suggest you decide on a database design, code up your form to handle the new format, and then come back when you get the point where you're processing it and displaying the calendar.
Info: PHP Manual
Posted 03 May 2006 - 07:28 PM
My only problem now is that I already tie my 'listings' table in with my 'users' table. When members login to the members area, it displays their old listings. I used INNER JOIN on the 'userid' field for both tables.
If I setup my database design like you mentioned, can I connect 3 tables together?
Thanks for the reply!
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users