Home › Forums › Back End › How to get admin_level of logged in user!? › Reply To: How to get admin_level of logged in user!?
June 6, 2016 at 4:13 am
#242540
Ilan Firsov
Participant
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 WHERE
clause.
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.