Page 1 of 1

how to validating a user.,

Posted: Mon Jul 21, 2008 10:36 pm
by heero
:|
how to apply a php code to fetch record in my database(MySqL:SQLyog) that determine whether a
the user is an "admin" or just "user"? My database "tblmember" has this following fields
"id, username, password, accessLvl "., accessLvl ("admin and user ").,

Hope for a positive response.,

Re: how to validating a user.,

Posted: Tue Jul 22, 2008 10:16 am
by Verminox

Code: Select all

SELECT * FROM `tblmember` WHERE `username` = 'something' AND `accessLvl` = 'admin'
If one row is the result, that means the user is indeed an admin.

Alternatively, if you have already fetched all the details of the user in a previous query, the information must be in the PHP variable where you stored the results. So for example, you can check $user['accessLvl'] and see if it is 'admin' or 'user'