Jump to content


Photo

How can I figure out how to show this?


  • Please log in to reply
3 replies to this topic

#1 Gingechilla

Gingechilla
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 12 April 2006 - 01:56 PM

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?

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 12 April 2006 - 02:00 PM

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

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 12 April 2006 - 02:05 PM

[!--quoteo(post=364029:date=Apr 12 2006, 01:56 PM:name=Gingechilla)--][div class=\'quotetop\']QUOTE(Gingechilla @ Apr 12 2006, 01:56 PM) View Post[/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.


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!";
}

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 Gingechilla

Gingechilla
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 12 April 2006 - 03:31 PM

How can I do that with a search?

E.g:

Search and get all items
Search and get all users items

compare

show results?







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users