title: admin and user login php mysql form
body: <p>Hey guys this is my php file named login.php. so whats my question. I want to have 2 user members: 1 admin and 1 user. admin and user must have different pages. In my code i have only user and if you will type normal users username and password it will lead you to the users page, but i cant do same on admins username and password it shows nothing.Help me guys to make admins login too.</p>
  
  <pre><code>&lt;?php
  
      $host = "localhost";
      $user = "root";
      $pass = "";
      $db = "test";
      $tbl_name = "users";
      $tbl_name1 = "admins";
  
      mysql_connect($host, $user, $pass) or die (mysql_error());
      mysql_select_db($db) or die (mysql_error());
  
      if(isset($_POST['username'])) {
          $username = $_POST['username'];
          $password = $_POST['password'];
          $sql = "SELECT * FROM users WHERE username='".$username."' AND password='".$password."' LIMIT 1 ";
          $res = mysql_query($sql);
  
  
          if(mysql_num_rows($res) == 1) {
              header("location:update.php");
              echo "You have successfuly logged in.";
              exit();
          } else {
              // session_register("username");
              // session_register("password");
              echo "Invalid logind information. Please return to the previous page";
              header("location:login.php");
  
              exit();
          }
  
      }
  
      ?&gt;
  </code></pre>