Jump to content

Display a user group


facarroll

Recommended Posts

I have a mysql database (innoDb) with two tables. The first table is called Admin and contains the following columns.

id (autoincrementing), AdminName and AdminPwd.

The second table is called Users and contains columns id(autoincrementing), UserName, UserPwd and id_Admin (foreign key)

 

I want to be able to create several administrators who can then create their own list of users, and that list is completely unrelated to other lists of users.

 

I would appreciate some help. I can display the users in a table, but all users are displayed at the same time. I can log on as any one of the administrators to select users, but am unable to display the group belonging only to the logged in administrator.

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/203842-display-a-user-group/
Share on other sites

groups (id, name)

users (id, group_id, username, password)

users_lists (admin_id, user_id)

 

Your going about it the wrong way. You don't need the extra admins table. You would check if a user is an admin (part-of group) in your application and load a user list for these users.

Thanks Ignace. I'm so new I hardly get it. I'll post some code I'm using as well as the database connect file. It's a purchased program that I want to adapt to allow several administrators to create their own user groups.

 

[attachment deleted by admin]

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.