First off, to give you an idea, I have two tables, plus my session variables. I'm first selecting from the table: user_resources where the user_id = that of the $_SESSION's, and in user_resources, there are three fields, user_id, resource_id, and amount, and I wish to print all of this. But the hitch to it is, resource_id is an integer. In another table called resources, are the fields id and name. The resource_id = resources.id, and I want to print the name associated with that id...
So this is the current code that I have now (I've tried thousands of combinations it seems like):
CODE
//Begin Resources Table
$query = mysql_query("SELECT * FROM user_resources, resources WHERE ". $_SESSION['userid'] ." =
user_resources.user_id user_resources JOIN resources ON user_resources.id = resources.id") or
die(mysql_error());
echo("<br><br><br><center><b>Resources</b><table border='1' bordercolor='black'>");
while($info = mysql_fetch_assoc( $query ))
{
echo "<tr>";
echo "<th>Name:</th> <td>".$info['amount'] . "</td> ";
echo "<th>Amount:</th> <td>".$info['name'] . " </td>";
}
echo "</font>";
echo "</table>";
$query = mysql_query("SELECT * FROM user_resources, resources WHERE ". $_SESSION['userid'] ." =
user_resources.user_id user_resources JOIN resources ON user_resources.id = resources.id") or
die(mysql_error());
echo("<br><br><br><center><b>Resources</b><table border='1' bordercolor='black'>");
while($info = mysql_fetch_assoc( $query ))
{
echo "<tr>";
echo "<th>Name:</th> <td>".$info['amount'] . "</td> ";
echo "<th>Amount:</th> <td>".$info['name'] . " </td>";
}
echo "</font>";
echo "</table>";
As you can see, all I wish to show is the amount of resources by its name. But I'm not sure how to get all of that in one query. As a review on the tables:
user_resource.user_id = $_SESSION['userid']
user_resource.resource_id = resource.id
And then I want the name and amount from user_resources.
I know, not hte best list in the world, but it gives a good idea of what I need. If anyone could help me out on this code snippet, it would be very much appreciated. I've spent over 3 hours on this so far and about to lose it if I can't figure this out.

