-
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:
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
-
There was a time you could access the Request-variables without any additional code, but now you need to write:
PHP Code:
$users_level = int($_GET["users_level"]);
or:
PHP Code:
$users_level = int($_REQUEST["users_level"]); // this also takes _POST
-
Ok, solved thanks for help kung foo man.