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

Link to comment
Share on other sites

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]

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.