Jump to content

display all users but not my self


Birdmansplace

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
https://forums.phpfreaks.com/topic/277292-display-all-users-but-not-my-self/
Share on other sites

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.