first off...
why are you using three tables for logins if you check them all at the same time??
I woul do the following -->
table access -->
* Id
* login
* password
* heriarchy --> this would be admin, freinds and mailing
then the code -->
- Code: Select all
$table = "access";
$sql = "SELECT login, password FROM ".$table." where login='$user' and password='$passwrd'";
$sql_result= mysql_query($sql,$db) or die ("<h3>Couldn't select information</h3></BODY></HTML>");
if ($row = mysql_fetch_array($sql_result)){
do{
echo "You are logged in ".$row["login"];
switch ($row["login"]){
case "admin":
echo "<br> You are the admin";
break;
case "friend":
echo "<br> You are a friend";
break;
case "mailing":
echo "<br> You want to use the mailbox";
break;
}
}while ($row = mysql_fetch_array($sql_result));
}else{
echo "Try again, please";
}
mysql_close($db);
bye!

