Jump to content


Photo

Need a little guidance


  • Please log in to reply
2 replies to this topic

#1 1042

1042
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 14 September 2006 - 09:46 PM

Hi all,

i have a question and i was wondering if someone could get me on the right track, im building a site for members, i have the login part completed, within this site i have an events page also, on the admin part the user can add events for others to see, my events table is simple:

ID
Tittle
Content

what i need to do is allow the members to register for an event, for instance if they are reading the events i want to display a link that would say "register for event" and they can just click and register since they are already logged in, my question is should i make another table to hold the users that register for a particular event? and then have the link (thru a php script like a newsletter system )add their user name to that event? also how would i tell the system what users are register for a particular event (how would i combine both tables the events table and the users table) , i hope i made sense, i thank anybody in advance for the help.

#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 15 September 2006 - 12:12 AM

An oversimplification of how to go about it:

events table

| eventid |          desc        |    date    |
-----------------------------------------------
     1           mudwrestling...    11158347

regevents table

| eventid |        user_id      |    user_name    |
---------------------------------------------------
     1               27          durtibstrd

<?php

$query_event = $db->query("SELECT * FROM regevents WHERE user_id = '$userid'");
$event = $db->fetch_array($query_event);

$query_event2 = $db->query("SELECT * FROM events WHERE eventid = '$event[eventid]'");
$eventinfo = $db->fetch_array($query_event2);

?>

Of course database design and approach will vary depending on your plans in the big picture. And of course there are many methods. Hope that helps.
PHP Ninja

#3 1042

1042
  • Members
  • PipPip
  • Member
  • 27 posts

Posted 15 September 2006 - 08:49 PM

I see, but how would both tables be combined when inserting data in to them? thanks for the help in advance.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users