Jump to content

display all users but not my self


Birdmansplace
Go to solution Solved by jugesh,

Recommended Posts

I have a basic log in system setup for users to login.  The users are admins and i want to be able to display all users but not there self.  Basicly saying if tom, dick and my self are registered users when i see the list i dont want to see my name or if tom views the list he sees dick and my self.  Because in this list i have a user delete fuction and don't want them to delete them self.  Here is the code i have that displays it.

<? session_start(); ?>
<?php
ini_set("display_errors", "1");
error_reporting(E_ALL);
include("../dbinfo.php");
mysql_connect($host,$username,$password);
// Connect to server and select database.
mysql_select_db("$db_name")or die("cannot select DB");
$sql="SELECT * FROM users ORDER BY username";
$result=mysql_query($sql)
?>
<div align="center">Admin List</div>
<br />
<table align="center" width="400" border="1" cellspacing="0" cellpadding="3" >
<tr>
<td align="center"><strong>Username</strong></td>
<td align="center"><strong>Delete</strong></td>

</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td><? echo $rows['username']; ?></td>
<td align="center"><a href="deletereg.php?sid=<? echo $rows['sid']; ?>"><input name="" type="button" value="Delete" /></a>


</tr>
<?php
}
?>
</table>

<?php
mysql_close();
?>

I was thinking some sort of "if" statment that could do this and just cant think of how to do it.  Thanks for your help

 

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.