Spot of bother in dreamweaver (mysql)

Discussion in 'PHP' started by Jabowen, May 19, 2010.

  1. #1
    Ok, so I have a custom made kind of cms. (bare with me now)
    the site has a userbase and what I'm trying to create is an events page where users can create there own events and what not. Now what I'm struggling on is an attending button. I've made a db in mysql made up of 4 tables (excuse me if my terminology is not correct but look at the attachment and you'll get me).

    So to break it down-
    Roster ID- is the auto increment number
    Event ID- is the main event id.
    User ID- self explanatory
    Attending- (Result of checkbox, yes=1)

    Now my plan was to direct users to the viewevent.php?eventid=15 for example where they could read about the date/time of the event. If they would like to attend they could click the attend button then it inserts a table into that database which would be something like...

    Roster-1
    Eventid-15
    userid-1
    attending-1

    now that's no problem, but the problem I'm having is trying to display the information...
    At the bottom of the viewevent.php page I have a sentence
    "You are currently NOT attending this event"
    Where I have underlined is basically a 'show if...region (where it will only show if a recordset is there)' which is all well and good but since its a user based system I cant find a way to (which is where if you are confused, ignore what I said above and just listen below)...

    Basically break down the table so say now I'm logged in as USERID=1 & view the event id=15. I need to somehow get the recordset to use the 'SESSIONS' to retrieve what user ID I am logged in as and what page I am viewing to then provide the outcome which would be where the ATTENDING column is there? (if it was it would be 1)

    So kind of have two recordsets :s

    I'm really sorry I could imagine this is confusing for some! But I'm on my last leg here! If no one can resolve this could anyone help me with a way of making an 'attending' feature in mysql? how to lay out the database for example...

    Thank you for reading, its quite a big read :)

    Jac
     

    Attached Files:

    Jabowen, May 19, 2010 IP
  2. Jabowen

    Jabowen Active Member

    Messages:
    295
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    60
    #2
    I completed it! For anyone that comes across this thread I used the 'advanced' button (to the right when editing a record set) and used the following sql code

    SELECT attending, event_roster.attending
    FROM event_roster
    WHERE event_id = colname AND event_roster.user_id = colname2
    Code (markup):
    then for the Variables

    Name: Colname
    Type: Numeric
    Default Value: -1
    Runtime Value: $_GET['id']

    then for the second
    Colname 2
    Numeric
    -1
    $_SESSION['login_id']

    :D hopes this helps someone!

    Jac
     
    Jabowen, May 20, 2010 IP