EchoFool Posted March 4, 2008 Share Posted March 4, 2008 I have used an inner join on 2 tables on ItemID but for some unknown reason its getting the wrong row but I don't see how. From the logic i have placed in, it cannot be possible to get the result it is getting, but im sure I've done some silly mistake in the query that i have not spotted so maybe some one here can: <?php $Get = mysql_query("SELECT useritem.ItemID,useritem.Quantity FROM useritem INNER JOIN item ON item.ItemID WHERE item.Trade=1 AND useritem.UserID='{$_SESSION['Current_User']}' AND useritem.Quantity>0") Or die(mysql_error()); ?> I'll show ya the table layout i have with 2 items in ... one is the incorrect one which i will put in red and the other is the one that this query is meant to get. But sadly it grabs the one in red. The reason the red one is incorrect is because Trade is = 0 which is the only difference in my database. So i don't know why it's collecting that itemID of the red row instead of the black... Useritem table: ItemId | Quantity | UserID | ---1--- |-----5-----|----1-----| ---2---|-----1-----|----1-----| Item table ItemID | Trade | ---2---|-----0-----| ---1---|-----1-----| Quote Link to comment Share on other sites More sharing options...
EchoFool Posted March 4, 2008 Author Share Posted March 4, 2008 bump 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.