Hey Guys,

I have an "events" table in my DB and a "default_events" table also. Every day I display one event. I check to see if any rows in the "events" table match todays date and then display that event, if no events match by date, I check the "default_events" table by week day (like Wednesday).

I can display events and default events fine based on date or day, but I have a "limited_spots" field in the default_events table used for allowing only so many people to rsvp for that default event. So lets say a default event that happens every Monday is supposed to show 50 spots, then it is down to 1 spot left by the end of the day. Next Monday I need the spots to be back up to 50 and to remove the event participants from the guest list.

How should this be done? Also, yes I am a noob. Any help would be greatly appreciated, thanks!

- Drew

Member Avatar for iamthwee

I'm guessing you still want to retain all information... because you could just simply clear the limited_spots field every Monday? Not a good idea.

I'm thinking maybe you need a what_week_are_we_in field. That would probably work.

Thanks for the prompt response! I am asking for the most logical solution, so if this is not a good idea I understand. I would just like to know how you would go about this yourself? Appreciate the help :)

I'm guessing you still want to retain all information... because you could just simply clear the limited_spots field every Monday? Not a good idea.

I'm thinking maybe you need a what_week_are_we_in field. That would probably work.

Nevermind, figured out a better way to do it. Thanks anyways :)

Member Avatar for iamthwee

Not sure what everyone else thinks but perhaps two tables

+-------------+
|limited_spots|
+-------------+      +----------+
|[B]week_no [/B]     |      | rsvp     |
+-------------+      +----------+
      |              |[B]week_no[/B]   |
      +--------------+----------+
                     |spots_left|
                     +----------+
                     |Person    |
                     +----------+

The two tables are linked by week_no. using a left inner join. The spots_left field starts with 50. Every-time a new person RSVP's the spots_left field decrements by one.

Seems logical I guess? When you're processing the user input just make sure the user can't RSVP is the spots_left is < 0.

Member Avatar for iamthwee

Nevermind, figured out a better way to do it. Thanks anyways

Oops I didn't see your reply... What was your solution by the way out of interest?

Well, I have my info in "default" and insert that info into "events" if there are no events based on todays event. I can't believe I didn't think of that before hand lol. Now it works, and super simple.

Oops I didn't see your reply... What was your solution by the way out of interest?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.