Quote:
Originally Posted by
keyboard1333
The unique column I am using to see if they are an admin is called level. If it is set to 1 they are a normal user if it is set to 9 they are an admin. I am not very good at sql so could you please just show me how to check that?
Also in your code Traq, what should $userid equal?
From what I see in your code, level is not unique. There might be only one level=9 user, but any number of users could have level=1, correct?
What column do you have with a unique value for each record (e.g., your primary/unique key: id, user_id, username, etc.)?
In my code example, $userid would hold the unique id of the user you are trying to check (and the query, of course, would use the appropriate col name). You might get that value from a login form, for example, <input name="username">, or you might get it from a user function, like get_user_id($_POST['username']). Make sure you sanitize the value before you use it in your query.
Edit: sorry for the confusion - I meant to use your column name level in my post above, not type. I fixed it.