EchoFool Posted April 30, 2008 Share Posted April 30, 2008 I keep getting an error stating : Not unique table/alias: 'useritem' Not sure what I did wrong but I have narrowed it down to this query causing it, not sure where I went wrong though.. <?php $Get = mysql_query("SELECT useritem.Quantity,item.Size FROM useritem,item INNER JOIN useritem ON item.ItemID = useritem.ItemID WHERE useritem.UserID='{$_SESSION['Current_User']}' AND useritem.`Where`='1'") Or die(mysql_error()); ?> Hope you can help me out here ??? Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted May 1, 2008 Share Posted May 1, 2008 You don't need 'useritem' in the table list when you specify an inner join... SELECT useritem.Quantity, item.Size FROM item INNER JOIN useritem ON item.ItemID = useritem.ItemID WHERE useritem.UserID='" . $_SESSION['Current_User'] . "' AND useritem.`Where`='1' Also, using reserved words for column names is a really bad idea...it just makes life more difficult in the long run. Is useritem.where a numeric datatype (int, mediumint, smallint, etc), or is it a character type? If it's the latter, and it only contains numbers, change it. If it's the former, then you don't have to put the 1 in your query in quotes...MySQL only does a type conversion on it (it sees it as string because of the quotes and then converts it to match the column type), which is an extra, unnecessary operation. 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.