table relationship understanding

paulsimo

Registered User.
Local time
Today, 16:51
Joined
Nov 11, 2007
Messages
24
Could anybody please help with a problem I have regarding extracting data from 2 tables.
I am currently building a database that will allow users to complete their details to enter an event. I am building a register / log in section, a user enters their personal details on the database including a username and password (the username would be the primary key). After they have completed the initial registration, on subsequent visits to the database they can simply enter their username and password to log in.
Once logged in, the user has a choice of events to enter, they select the appropriate event and then complete some additional information to another table via a form.
The problem I have is how can I join the registration details table to the events table without the user having to complete their username details again in the events table.

What I am trying to achieve is for the username field to be automatically inserted (to enable me to relate the 2 tables) into the events table. Is this possible and how would I go about setting this up. I guess I am not fully understanding how relationships work

The registration table has the following fields:-
first name
surname
username (primary key)
password
email address

The events table has the following fields:-
eventID (primary key)
event name
date of event
arrival time
special requirements
username (auto inserted from users log in details)

The result of a query needs to include all of the above in both tables which will show which events a user has entered. A user would not be allowed to enter the same event more than once.

I understand how to build the query to achieve this, but seem to be baffled by how I can set up the relationship of the 2 tables with the username automatically being inserted into the events table.

Many thanks in anticipation.
 
This dosen't answer your question but, it may be a road to a more normal design.



The registration table has the following fields:-

registrationID (primary key)
firstname
surname
username
password
emailaddress

The events table has the following fields:-

eventID (primary key)
registrationID (foreign key)
eventname
dateofevent
arrivaltime
specialrequirements
 

Users who are viewing this thread

Back
Top Bottom