使用 php ciode 登录时遇到麻烦


Trouble for login using php ciode

我的数据库mywebsite有两个不同的表。表登录和表学生登录。你能建议我如何制作一个从两个表中检索数据的登录 php 代码页吗?

    <?php 
     if (!isset($_POST["username"]))

     {
     header('Location: login.html');
       }
      if (!isset($_POST["password"]))
      {
      header('Location: login.php');
      }
     else
       {
    session_start();    
    $username = $_POST["username"];
    $password = $_POST["password"];
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    include ("db_connect.php"); 
    $select = "SELECT * from login and studentlogin where username = '$username' and password = '$password'";
      $rows = mysql_query("$select");
    if (mysql_num_rows($rows)<1){
            mysql_close($con);
    header("location: http://localhost/Mywebsite/wrong.html");
       }
    else
       { 

        while($query = mysql_fetch_array($rows)) {
            $adm = $query['username'];

           $check = substr($adm, 0, 3);
             if ($check == 'adm')
                {
SELECT Orders.OrderID, Customers.CustomerName, Orders.OrderDate
FROM Orders
INNER JOIN Customers
ON Orders.CustomerID=Customers.CustomerID;

并阅读联接查询和表关系。