Results 1 to 3 of 3

Thread: Users level

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Private First Class
    Join Date
    Dec 2012
    Posts
    127
    Thanks
    132
    Thanked 114 Times in 63 Posts

    Users level in database

    Hey,

    I've got a problem with my PHP script - Admin Panel.
    Code looks fine but there is a notice about: Undefined variable: users_level
    I'm not sure but I've pointed mysql_query where the table and users_level is...

    Just want to make text like: You are logged in as: Jeplaa [Admin]


    The table in phpMyAdmin looks that:

    id name
    1 Admin
    2 Member



    Here's a code:

    PHP Code:
    <?php

        $connect 
    mysql_connect("localhost""root""");
        
    mysql_select_db("phplogin");

        
    $query_level mysql_query("SELECT name FROM users_level WHERE id = '$users_level'");
        
    $run_level mysql_fetch_array($query_level);
        
    $level_name $run_level['name'];
        
        
    $username $_SESSION['username'];

    ?>

    <html>
        <head>
            <title>Admin Panel</title>
        </head>
            <body>
                <h3>Admin Panel</h3>
                    
                <p>You are logged in as: <b><?php echo $username ?></b> [<?php echo $level_name ?>]</p>
            </body>
    </html>
    Please point me how to fix it.

    Thanks and regards in advance,
    Jeplaa
    Last edited by Jeplaa; 8th March 2013 at 14:54.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •