Each user in the databased is assigned a level, their is a table for levels and each level has permissions eg "view-clients" at login the user's level is made into $_SESSION['level'] i need to make an if statement that will echo code if the user's level "view-clients" is "checked".
This is the code is have but it wont echo it even when it is checked.
<?php
$level = mysql_real_escape_string($_SESSION['level']);
include("include/config.php");
$con=mysql_connect($db_host,$db_uname,$db_pwd,$db_name);
mysql_select_db($db_name);
$query = "SELECT * FROM levels WHERE name='$level'";
$result=mysql_query($query);
while($rows = mysql_fetch_array($result)){
$a1=$rows['0'];
$a2=$rows['1'];
$a3=$rows['2'];
$a4=$rows['3'];
$a5=$rows['4'];
$a6=$rows['5'];
$a7=$rows['6'];
$a8=$rows['7'];
if ($a5=="checked") {
echo "Clients";
}
}
?>
I have tried a few things such as not using a variable as the session. I am thankful for any help.