Jump to content

[SOLVED] Member List - Excluding a Record


jonoc33

Recommended Posts

Hi guys,

I have a PHP code that displays a list of members out of a database.

The code is the following:

 

$results = mysql_query("SELECT username, userlevel FROM users");
while($values = mysql_fetch_array($results)){
     echo $values['username']."- Rank: ";
echo $values['userlevel'] != 9 ? "Member" : "Captain";
echo "<br />";
}

 

It displays the Username and the Userlevel, and changes the userlevel to a word (eg 1>Member, 9>Captain).

Now I made a user called "Admin", and it shows up in the memberlist.

What I want to do is have a code that excludes the username "Admin" from it, so only Users that don't have that username show up.

 

Any help?

 

Jono

Link to comment
https://forums.phpfreaks.com/topic/75989-solved-member-list-excluding-a-record/
Share on other sites

Well, simply put, you could just:

SELECT username, userlevel FROM users WHERE username<>'Admin'

 

Although if you set the Admin user to a userlevel of "10" or something, you could filter by that, to allow more than one admin level account.

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.