newbie question : sql 3 different tables

Codes here !

Moderators: egami, macek, gesf

Post Reply
User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Sat Jan 18, 2003 5:41 am

Hi ;)
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)){
      echo "You are logged in ".$row["login"];
      switch ($row["login"]){
         case "admin":
            echo "<br> You are the admin";
         case "friend":
            echo "<br> You are a friend";
         case "mailing":
            echo "<br> You want to use the mailbox";

   }while   ($row = mysql_fetch_array($sql_result));
   echo "Try again, please";


Post Reply