Hello,
I need to make an script that displays word "admin" or "regular member" etc below an username.e.g.If a member is admin it displays
"admin" below his username every time he posts. like here in daniweb.com whenever i post a thread it displays "Newbie poster" below my username. I don't have any idea how to do that...Help me plzzzzzzz.
Thankyou...,,,,..,..,..,...,.,.,.,.,,

Recommended Answers

All 2 Replies

How do you know whether a user is an admin or a regular member? If it is a database field then simply display that as well.

Hi

To explain what slyme said above you will need to add an aditional field in your table containing your members information. Then whenever you echo the username simply echo the "priv" field that should hold either the text "admin" or "standard user".

You should set the default value to "standard user" so that only you may edit who is an "admin" by editing the database.

A quick example but it's probably got mistakes i've only got 5mins :

<h1>List of members and priv's</h1>
$query = "SELECT * FROM members";
$result = mysql_query($query);
while ($col = mysql_fetch_array($result)) {
echo $col['username'];
echo "<br><br>They are a/an:";
echo $col['priv'];
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.