-
Jun 23rd, 2015, 11:30 AM
#1
Thread Starter
Frenzied Member
[RESOLVED] Dont display my logged in username
Hello,
I use this code to display my users
PHP Code:
echo "<b>Select Username</b>";
$users = mysql_query("SELECT `id`, `username` FROM `users`");
while ($run_user = mysql_fetch_array($users)){
$user = $run_user['id'];
$username = $run_user['username'];
echo "<p><a href='start.php?username=$user'>$username</a></p>";
}
How can i get it so my username dosent show as im logged in?
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
-
Jun 23rd, 2015, 12:27 PM
#2
Re: Dont display my logged in username
What have you tried yourself? It seems every post I see you make, you're posting what you have and how you want it modified, but there is never an attempt on your part to show what exactly you want or how you've tried to achieve it.
-
Jun 23rd, 2015, 01:43 PM
#3
Fanatic Member
Re: Dont display my logged in username
You should consider adding a column that displays if the user is online or not. and then you should add a column that is a boolean example "hide_from_list" so if it's 1, it should not show...
Code:
$users = mysql_query("SELECT `id`, `username` FROM `users` WHERE hide_from_list=0");
Last edited by Justa Lol; Jun 23rd, 2015 at 02:12 PM.
Reason: forgot code tags...
-
Jun 23rd, 2015, 02:21 PM
#4
Re: Dont display my logged in username
Originally Posted by kfcSmitty
What have you tried yourself? It seems every post I see you make, you're posting what you have and how you want it modified, but there is never an attempt on your part to show what exactly you want or how you've tried to achieve it.
Agreed.
Also, just change your SQL query so that you are not looking for your user id. "WHERE id NOT 'yourid'"
https://dev.mysql.com/doc/refman/5.1...l#operator_not
My usual boring signature: Something
-
Jun 23rd, 2015, 04:46 PM
#5
Thread Starter
Frenzied Member
Re: Dont display my logged in username
Hello,
I tried this code on the logout page but uit wont change the 1 to a 0?.
<?php include('styles/top.php'); ?>
<div id="left">
<p><?php
$user = $_SESSION['username'];
if ($user){
mysql_query("UPDATE users SET online='0' WHERE username='$username'");
session_destroy();
echo "<meta http-equiv='refresh' content='5;url=index.php'>";
echo "<b>$user</b> has been logged out please wait.";
}
else
echo "No user was logged in!.";
?>
</p>
</div>
<?php include('styles/bottom.php'); ?>
come back and mark your original post as resoved if your problem is fixed
Jamie Garland
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|