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
https://forums.phpfreaks.com/topic/18500-find-out-how-many-unique-members/
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.

Archived

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

×
×
  • 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.