The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Question in mysql and php Re: Question in mysql and php


I literally don’t understand what you’re saying. Punctuation, grammar, and spelling are essential for communication.

From what I could surmise, you’re trying to decide if a user is of a specific type, and taking action accordingly. On your database table "users", have a field called "type". Make it a Boolean if there is only 2 types of users, or a Varchar if there are many. Then, your **QUERY** can look something like this:

"SELECT type FROM users WHERE user_name=’$name’ AND password=’$pass’"

In your php, simply do this:

if ($type==(0 or admin, depending on the type of field)) {
//Do whatever for admins
else {
//Do whatever for regular users

In the future, please group your questions into single thoughts separated by punctuation for clarity. It makes it WAY easier for people to help you.