So, I just wrote a code where the admin can look at the username and password of the users. I wrote bit of code and copied a bit from w3schools :p. So. Whenever I run the code, it shows the error [Call to a member function query() on resource]
Here's my code:
Process.php
<?php
    $username = $_POST['uname'];
    $password = $_POST['pass'];
    $username = stripcslashes($username);
    $password = stripcslashes($password);
    $username = mysql_escape_string($username);
    $password = mysql_escape_string($password);
    $conn = mysql_connect("localhost","root","");
    mysql_select_db("Login3");
    $result = mysql_query("select * from users where username = '$username' and password = '$password'");
    $row = mysql_fetch_array($result);
    if($row['username'] == $username && $row['password'] == $password) {
        echo "Welcome " . $row['username'];
    }
    else {
        echo "Invalid Credentials";
    }
    echo <h3>User List</h3>;
    mysql_connect("localhost","root","");
    mysql_select_db("Login3");
    $sql = "SELECT id, username, password FROM users";
    $request = $conn->query($sql);
    if ($result->num_rows > 0) {
        while($row = $result->fetch_assoc()) {
            echo "<br> id: ". $row["id"]. " - Name: ". $row["username"]. " " . $row["password"] . "<br>";
        }
    } else {
        echo "0 results";
    }
    $conn->close();
?>
Index.html
<!DOCTYPE html>
<html>
<head>
    <title>Login | Home</title>
</head>
<body>
    <form action="process.php" method="POST">
        <h3>Login</h3>
        Username: <input type="text" name="uname"><br><br>
        Password: <input type="password" name="pass"><br>
        <input type="submit" name="btn">
    </form>
    <br>
    <b>Test Accounts</b>
    <table>
        <tr>
            <th>Username</th>
            <th>Password</th>
        </tr>
        <tr>
            <td>admin</td>
            <td>admin@123</td>
        </tr>
    </table>
</body>
</html>
<style>
    table, th, tr, td {
        width: 25%;
        border-collapse: collapse;
    }
    th, td {
        border: 1px solid grey;
        text-align: center;
    }
    tr {
        background: white;
        transition-duration: 0.3s;
    }
    tr:hover {
        background: #ddd;
    }
Please correct my code and tell me where i am wrong.
 
     
    