Your current script selects the first column (which is
admin_level since you select only this one column) of the first row of the result set.
You should modify your query to select the
admin_level of a specific user by targeting it with a
Might be something like the following though it is dependent on your database structure:
<?php $conn->prepare("SELECT admin_level FROM users WHERE email = ? "); $sth->execute(array( '[email protected]' ));
Also I’d suggest not trying to create your own user authentication system. It is quite hard and very prone to security issues.