Jeplaa
8th March 2013, 14:32
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
$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
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
$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