I decided to try the join thing instead of doing 2 seperate queries, but am having trouble getting it to work
I read some posts on here and also the mysql docs and tried to copy pretty much exactly that way, but it doesn't work:
here is what I have:
well, I didn't know using * wasn't good, I'll just specify each field I need
I redid a few parts so all I need is the name from the items table where that id matches what is in the "holding" field fo the user_book table
I wasn't get any errors before, but I changed it to reflect what you suggested I trey and now I get an error:
$ret = mysql_query( "select name from items JOIN user_book ON items.id=userbook.holding where userbook.user_name='{$session["name"]}'" );
$name = mysql_result($ret);
echo "<br>name is: ".$name;
Now you've got user_book and userbook in the query - they need to be the same.
Also, your variable $name is a result set object. You were nearer with your first code, in that you need to extract the variables from the result set before you can use them, using mysql_fetch_array.