Jump to content

How not to display admin when fetching data from mysql user table


Go to solution Solved by malkocoglu,

Recommended Posts

Dear users,

 

I am trying to disregard ADMIN when displaying registered users from USERS table.

 

The code I am using is

if($session->isAdmin()) {$query="SELECT username FROM users ";}

This gives me all the users from the database. What I want to do is not to display ADMIn and display the rest of the users.

 

is it possible? Could anyone help?

you would add a WHERE term to your query that either excludes the admins or selects everyone but admins, whichever is easier to do.

 

edit, lol, see the above reply by jessica.

Edited by mac_gyver

Thanks for quick replies. Could you possible wrote the code where it excludes the ADMIN?

 

No, because we have no idea what you may, or may not, have in your database to identify what an ADMIN is.

 

Do you have a column called "admin" with a 0/1 value?

 

SELECT username FROM users WHERE admin = 0
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.