Gingechilla Posted April 12, 2006 Share Posted April 12, 2006 I have the following tables in my database:items < Holds all over the items information ect.userinfo < Holds information on userusersitems < Holds what the user has got.From the search page a user can add things from the items table into the usersitems table, that works fine.The problem I have is, how can I show what items a user does not have? Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 12, 2006 Share Posted April 12, 2006 The following is very high level coding. :-)Get all of the items and put into an array.Get all of the items the user has and put into an array.Do an array_diff() to find out what the user doesn't have.Ken Quote Link to comment Share on other sites More sharing options...
redarrow Posted April 12, 2006 Share Posted April 12, 2006 [!--quoteo(post=364029:date=Apr 12 2006, 01:56 PM:name=Gingechilla)--][div class=\'quotetop\']QUOTE(Gingechilla @ Apr 12 2006, 01:56 PM) [snapback]364029[/snapback][/div][div class=\'quotemain\'][!--quotec--]I have the following tables in my database:items < Holds all over the items information ect.userinfo < Holds information on userusersitems < Holds what the user has got.From the search page a user can add things from the items table into the usersitems table, that works fine.The problem I have is, how can I show what a user does not have?[/quote]post your code to see ok but sometihnk like this i think.ALWAYS BACK YOUR DATAUP BEFORE USEING ANY OF MY CODE.[code]if($items <0) {echo"this user has no items!";}else{if($userinfo < 0) { echo " this user has no userinfo!";}else{if($usersitems < 0) {echo"this user has no user items!";}[/code] Quote Link to comment Share on other sites More sharing options...
Gingechilla Posted April 12, 2006 Author Share Posted April 12, 2006 How can I do that with a search?E.g:Search and get all itemsSearch and get all users itemscompareshow results? 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.