Jump to content

find out how many unique members


desithugg

Recommended Posts

umm im having trouble checking if all the items selected in a form are all owned by the selecter.
[code]
$query = "SELECT ip FROM signup";
$result = mysql_query($query) or die(mysql_error());
while($row = mysql_fetch_assoc($result)){
$unique[] = $row['ip'];
}
$my_check = mysql_result($result, 0);
$result = array_unique($unique);
print_r($result);
?>
[/code]
well thats what i came up with i was wondering if it will work cuz i dont have time to test it.right now
Link to comment
Share on other sites

without more information, i can only speculate, but:

assuming that you have a form that lists a whole bunch of stuff, and the user is selecting some of the stuff, and you wish to check if the user owns the items he selected, i would make a relational database with 3 tables like so:

[code]
Users        Items_Owned      Items
=====        ===========      =====
Username    Itemid --------> Itemid
Userid ----> Userid          Itemname
[/code]
the arrows are there so you can see how each table (Users, Items_Owned, and Items) have a common fieldname.  In the Users table, you would store information about the user.  In the Items table, you would store information about each item.  Then in the Items_Owned table, you would store each item that a user would own.  If you set it up this way, then you can simply do a query to list all Items owned, based on the userid.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.