How do I set up this query? I have awards in a table. For example, a trophy may be award_id 1 in the award table. A ribbon may be award_id 2 in the award table. I then have another table, award_user, where it has the award_id and the userid of the user. So, if I wanna give the user the award_id 1, and their userid is 25, it will be in the award_user table as award_id 1 and userid 25 (which means they have that award). I want to select all of the awards the user has based off of their userid.
Here is the thing, though. The awards are in the award table, but the actual user information about the awards are in the award table. So, I will have to select from two different places, I guess.
Here is what I have so far..
$query = mysql_query("SELECT * from award WHERE award_id = (SELECT award_id FROM award_user WHERE userid = $userid)");
Not sure if this will work or not.
Basically, it has to select the awards from the award table with the award_id's that the userid has. $userid is a valid variable, it is their userid.
Thanks!