Single MySQLI query to check for admin privileges
You do not need to re-fetch or use a while loop, simply reuse the array that you fetched the first time.

&lt;?php
session_start();
$identification = $_SESSION['session_name'];
include 'inc/database.php';
$query = "SELECT * FROM `members` WHERE `username` = '$identification' LIMIT 1";

$result = mysqli_query($database, $query);

$user_info = mysqli_fetch_array($result, MYSQLI_ASSOC);
$user_level = $user_info["privs"];
if ($user_level=='ADMIN'){} 
else {
  header('Location: security.php?error=missing correct privileges. user is not admin');
  exit();
}

?&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Zona de Pruebas&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
Username: &lt;?php echo $user_info['username']?&gt;, can be here because is admin&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;?php
}
?&gt;