|
Posted by Tarscher on 12/21/07 12:06
On 21 dec, 12:52, Captain Paralytic <paul_laut...@yahoo.com> wrote:
> On 21 Dec, 11:43, Tarscher <tarsc...@gmail.com> wrote:
>
>
>
> > On 21 dec, 12:24, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > On 21 Dec, 11:18,Tarscher<tarsc...@gmail.com> wrote:
>
> > > > On 21 dec, 12:12, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > > > On 21 Dec, 10:52,Tarscher<tarsc...@gmail.com> wrote:
>
> > > > > > On 21 dec, 11:45, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > > > > > On 21 Dec, 10:36,Tarscher<tarsc...@gmail.com> wrote:
>
> > > > > > > > On 21 dec, 11:13, Captain Paralytic <paul_laut...@yahoo.com> wrote:
>
> > > > > > > > > On 21 Dec, 08:43,Tarscher<tarsc...@gmail.com> wrote:
>
> > > > > > > > > > Hi all,
>
> > > > > > > > > > I have events containing attendees (events has many attendees). The
> > > > > > > > > > attendee table tells whether a user will attend the event or not. I
> > > > > > > > > > want to build a query that returns all the different events to a user
> > > > > > > > > > and if he will attend the event or not (or hasn't filled it in yet)
>
> > > > > > > > > > the returned result could be something like:
>
> > > > > > > > > > event.id attendees.user_id attendee.present
> > > > > > > > > > 1 1 0
> > > > > > > > > > 2 1
> > > > > > > > > > 3 1 1
>
> > > > > > > > > > Please note that attendee.present can be null if the user didn't yet
> > > > > > > > > > tell if he would come to the event.
>
> > > > > > > > > > Can this be done?
>
> > > > > > > > > > thanks
> > > > > > > > > > Stijn
>
> > > > > > > > > And this has what to do with php?
>
> > > > > > > > > You would be better to ask this in a database group.
>
> > > > > > > > > However some questions:
> > > > > > > > > If a user is querying the database to find if he will be attending the
> > > > > > > > > event, why does his own ID need to be present in the output?
> > > > > > > > > How does the attendee's id get into the table against an event in the
> > > > > > > > > first place?
>
> > > > > > > > I indeed don't need the user_id since it is stored in the session. It
> > > > > > > > was just to clarify that the query need to return 1 user.
>
> > > > > > > > Via the session the user_id stored in the session.
>
> > > > > > > > Regards
>
> > > > > > > I don't understand how
> > > > > > > "Via the session the user_id stored in the session."
>
> > > > > > > answers the question
> > > > > > > "How does the attendee's id get into the table against an event in the
> > > > > > > first place?"
>
> > > > > > sorry, a typo
>
> > > > > > INSERT INTO attendee (event_id, user_id) VALUES ($event_id,
> > > > > > session['user_id'])
>
> > > > > > I get the event_id via the url since the user does this per event.
> > > > > > eg
> > > > > > event1: 'will attend' 'will not attend'
> > > > > > event2: 'will attend' 'will not attend'
>
> > > > > > The 'will attend' and 'will not attend' links point to the sql query
> > > > > > inserting in attendee
>
> > > > > > I hope this helps
>
> > > > > No, that is not what I mean.
>
> > > > > You have a table attendee which contains events. Personally I would
> > > > > have an events table to contain the events.
>
> > > > > Now you tell us that the attendee table has events and attendees and
> > > > > it is possible for an attendee to say that they will not attend the
> > > > > event. I have to say that someone who will not attend an event will by
> > > > > definition not be an attendee!
>
> > > > > My question is, if for some reason you have all your events listed in
> > > > > the attendee table and the attendee has not put in there a record
> > > > > saying that he will or will not attend the event, how did the record
> > > > > with the event id and attendee id get in the table in the first place?
>
> > > > I have an event table and attendee table (events has many attendees).
> > > > The event_id in attendee points to the key of the event table.
> > > > event table: id, name, time
> > > > attendee table, id, user_id, event_id, present
>
> > > Things aren't as stated in your first post.
>
> > > However you STILL haven't answered my question.
>
> > > How does an attendeed get an entry in the attendee table against a
> > > particular event? You have suggested that the entry can be there
> > > before the prospective attendee has looked at the table, so HOW did it
> > > getthere?
>
> > Sorry, I have a hard time understanding your question.
>
> > The attendee can enter because he sees all available events (with
> > attend and not attend link behind): the one he attends, the one he
> > will not attend and the one he hasn't yet voted on (in this case there
> > is no attendee record for that user for that event.)
> > we have 3 cases:
> > - on the list of events the user clicks an event he previously said he
> > would attend to not attend. The attendees present record changes to 0
> > - on the list of events the user clicks an event he previously said he
> > would not attend to attend. The attendees present record changes to 1
> > - on the list of events the user clicks an event he hasn't 'voted' on
> > yet. An attendees record is created in the attendee table
>
> > i hope this helps
>
> This doesn't make much sense to me.
>
> Why have a record in the attendee table if the person will not be an
> attendee?
> Why put a record in the attendee table just because a person has
> looked at the detals of an event from the event table?
>
> Why not just list the events from the event table, LEFT JOINED to the
> attendee table. If there is no entry in the attendee table, the person
> is not yet an attendee. If you really want to have a record in the
> attendees table for people who will certainly not be attendees (this
> seems crazy) then I still don't see why you would want to put an entry
> in there when all the person has done is looked at the event.
Cos there is a clear difference between saying you don't attend or
haven't said yet you will or will not attend. This way I can show the
user whether he already entered his attendence for this event. (which
he has to do) It works as a reminder
> Why put a record in the attendee table just because a person has
> looked at the detals of an event from the event table?
This doesn't happen unless the user himself votes his presense (via
the link)
Navigation:
[Reply to this message]
|