Jump to content

Archived

This topic is now archived and is closed to further replies.

Gingechilla

How can I figure out how to show this?

Recommended Posts

I have the following tables in my database:

items < Holds all over the items information ect.

userinfo < Holds information on user

usersitems < 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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
[!--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 user

usersitems < 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]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.