Jump to content

Recommended Posts

Hi, I am still working on setting up an event listing form, and would like to know if anyone can give me any help or advice.
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.
Thanks!
Link to comment
https://forums.phpfreaks.com/topic/8973-event-form-setup-help/
Share on other sites

First off, I'm going to tell you that your database design is incorrect. Having column names like column1, column2, etc is poor, poor design.

You should have 2 tables:
table 1:
eventID
type
summary
highlight

table2:
eventID
month
day
time

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.
Link to comment
https://forums.phpfreaks.com/topic/8973-event-form-setup-help/#findComment-33001
Share on other sites

First, let me say that yes my database design is weak, but it got me started. I am not too advanced with php/mysql so that is the reason why it is weak. I kinda see what your saying about setting up two tables.

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!
Link to comment
https://forums.phpfreaks.com/topic/8973-event-form-setup-help/#findComment-33081
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.