Ive been working on this sooo long im about to give up. Im trying to carry out a query that involves 4 tables in all
I have tables
qualityadmin
qualityadmin_id (PK)
quality_name
address1
structure here http://www.mindseyemidlands.co.uk/qualityadmin.gif
activity
activity_id (PK)
activity
structure here http://www.mindseyemidlands.co.uk/activity.gif
activityorg
activityorg_id (PK)
actvity_id
qualityadmin_id
activityuser
activityuser_id
username
activity_id
A qualityadmin can do many activities and to show this the qualityadmin_id & activity_id is recorded in the activityorg table:
http://www.mindseyemidlands.co.uk/activityorg.gif
In a form a user can choose many activities and his/her choices are stored in activityuser
http://www.mindseyemidlands.co.uk/activityuser.gif
My query takes what activities the user chose from the form and compares each activity_id in activityuser with the activities the qualityadmin does in activityorg. The outcome is that the user knows the quality_name's that carry out the activities they have chosen in the form.
How can I do this query.
here is my effort to date- this produces a list of numbers all saying '1' which is wrong because it is supposed to show the list of 'quality_name's.'
if (isset($_GET['activity_checkbox'])) {
$sql = "SELECT activityuser.activity_id, activityorg.activity_id, qualityadmin.qualityadmin_id
FROM activityuser, activityorg, qualityadmin
WHERE activityuser.activity_id = activityorg.activity_id";
$result = mysql_query($sql) or die(mysql_error());
echo $result;
}