Jump to content

imafish

New Members
  • Posts

    6
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

imafish's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. [code]while($row = mysql_fetch_array($result_groupsmember, MYSQL_ASSOC)){ //Get all groups user is part of and store in an array //echo $row['name']; $a = array($row['name']); }[/code] Basically I want it so that each item from $row['name'] goes into the array.
  2. Thanks for that; I've just started it! Except I get only the last member of the array. Ive created an array by going $a = array($groupnamelist); that correct?
  3. Sorry The tables are [b]groupsuser[/b] groupid | userid     9    |    60     5    |    60     3    |    60 [b]groups[/b] groupid | name     1    |  firestation     2    |  police     3    |  supermarket So groupuser links to groups, so a user can be in many groups.
  4. Here is what I have got, that selects the groups (from the group table) that the user is in. All I need to add is the OTHER group names, that are not selected. [code]//Query the table to see if the user is part of any groups $query_groupsmember = "SELECT u.id, um.id, u.name, u.description, um.userid, um.groupid FROM usersgroup u, usersmembership um WHERE userid=$userid AND um.groupid = u.id;"; $result_groupsmember = mysql_query($query_groupsmember) or die ('Query failed: ' . mysql_error()); while($row = mysql_fetch_array($result_groupsmember, MYSQL_ASSOC)){ //Displays and marks the existing groups echo "<tr><td>"; $groupname = $row['name']; $groupdesc = $row['description']; $groupid = $row['id']; $group_group = $row['groupid']; echo "<input type=\"checkbox\" checked=\"yes\" id=\"$groupid\" value=\"$groupname\" title=\"$groupdesc\">$groupname<br>"; echo "<td></tr>"; }[/code]
  5. Ok. User 60 is in groups: supermarket, bottleshop, petrolstation, firehouse IS NOT in the rest; garage, garden, busstop, airport, boat, policehouse they should all come up in the list, but only [b]supermarket, bottleshop, petrolstation, firehouse[/b] should be ticked.
  6. Hi I've got two tables, one is the name of the group the other is the memberships the user is in. I want a all the groups to come up, but the groups the user is in to be ticked. I can make the list of groups the user is in come up, but not the rest of the groups the user [i]isn't[/i] in. Thanks
×
×
  • 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.