Jump to content

Archived

This topic is now archived and is closed to further replies.

1042

Need a little guidance

Recommended Posts

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.

Share this post


Link to post
Share on other sites
An oversimplification of how to go about it:

[color=orange]events[/color] table

[code]
| eventid |          desc        |    date    |
-----------------------------------------------
    1          mudwrestling...    11158347[/code]

[color=orange]regevents[/color] table
[code]

| eventid |        user_id      |    user_name    |
---------------------------------------------------
    1              27          durtibstrd[/code]

[code]<?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);

?>[/code]

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.

Share this post


Link to post
Share on other sites
I see, but how would both tables be combined when inserting data in to them? thanks for the help in advance.

Share this post


Link to post
Share on other sites

×

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.