mdnghtblue Posted February 22, 2008 Share Posted February 22, 2008 $allies = mysql_query("SELECT num, clan FROM players WHERE clan=$users[clan];"); $market = mysql_query("SELECT * FROM market WHERE time<=$time AND seller=$allies;"); // not sure what to put instead of $allies? How can I limit the second query to the sellers with the "num"s selected from the first query? I kinda doubt the way I set it up above works. Quote Link to comment Share on other sites More sharing options...
fenway Posted February 22, 2008 Share Posted February 22, 2008 How are these two tables related? Quote Link to comment Share on other sites More sharing options...
mdnghtblue Posted February 22, 2008 Author Share Posted February 22, 2008 They're just in the same database. "seller" from market, and "num" from players are the same kind of data. (don't really know how to use relations in mySQL yet =/) Quote Link to comment Share on other sites More sharing options...
fenway Posted February 22, 2008 Share Posted February 22, 2008 You mean "num" is the ID and seller is the ID from the clan/players table? If so: SELECT p.num, p.clan, m.* FROM players AS p INNER JOIN market AS m ON ( m.seller = p.num ) WHERE m.time<=$time AND p.clan=$users[clan] I'd rename "num" as player_id and seller as seller_id (or player_id) to make this more obvious. Also, make sure to quote those literals. Quote Link to comment Share on other sites More sharing options...
mdnghtblue Posted February 22, 2008 Author Share Posted February 22, 2008 Thanks very much. =) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.