954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Need a Logical Solution..

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

drewpark88
Junior Poster
177 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
 

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.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

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.

drewpark88
Junior Poster
177 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
 

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

drewpark88
Junior Poster
177 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
 

Not sure what everyone else thinks but perhaps two tables

+-------------+
|limited_spots|
+-------------+      +----------+
|<strong>week_no </strong>     |      | rsvp     |
+-------------+      +----------+
      |              |<strong>week_no</strong>   |
      +--------------+----------+
                     |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.

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 
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?

iamthwee
Posting Expert
5,950 posts since Aug 2005
Reputation Points: 1,543
Solved Threads: 439
 

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?
drewpark88
Junior Poster
177 posts since Feb 2010
Reputation Points: 45
Solved Threads: 5
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: