Results 1 to 5 of 5

Thread: [RESOLVED] Dont display my logged in username

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    Resolved [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

  2. #2
    PowerPoster kfcSmitty's Avatar
    Join Date
    May 2005
    Posts
    2,248

    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.

  3. #3
    Fanatic Member
    Join Date
    Jun 2008
    Posts
    1,023

    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...

  4. #4
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Re: Dont display my logged in username

    Quote Originally Posted by kfcSmitty View Post
    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

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2004
    Posts
    1,202

    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
  •  



Click Here to Expand Forum to Full Width