Jump to content


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


find out how many unique members

Recommended Posts

umm im having trouble checking if all the items selected in a form are all owned by the selecter.
$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);
well thats what i came up with i was wondering if it will work cuz i dont have time to test it.right now

Share this post

Link to post
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:

Users        Items_Owned      Items
=====        ===========      =====
Username    Itemid --------> Itemid
Userid ----> Userid          Itemname
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.

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.