I have a login.php, register.php page. 
The register page is working fine, but I have a problem with my login page. 
When I log in successfully, it is supposed to redirect me to a page called member.php but instead just stays on the same page and goes no where. 
Here is my code for the login.php page where I think the problem may be occuring I have tried replacing header("Location: member.php"); with echo("Success") and it works:
Login.php
<!doctype html>
<html>
    <body>
        <p><a href="register.php">Register</a> | <a href="login.php">Login</a></p>
        <h3>Login Form</h3>
        <form action="" method="POST">
            Username: <input type="text" name="user"><br />
            Password: <input type="password" name="pass"><br /> 
            <input type="submit" value="Login" name="submit" />
        </form>
<?php
if(isset($_POST["submit"])) {
    if(!empty($_POST['user']) && !empty($_POST['pass'])) {
        $user=$_POST['user'];
        $pass=$_POST['pass'];
        $con=mysql_connect('localhost:8889','root','root') or die(mysql_error());
        mysql_select_db('user_registration') or die("cannot select DB");
        $query=mysql_query("SELECT * FROM login WHERE username='".$user."' AND password='".$pass."'");
        $numrows=mysql_num_rows($query);
        if($numrows!=0) {
            while($row=mysql_fetch_assoc($query)) {
                $dbusername=$row['username'];
                $dbpassword=$row['password'];
            }
            if($user == $dbusername && $pass == $dbpassword) {
                session_start();
                $_SESSION['sess_user']=$user;
                header("Location: member.php");
            }
        } else {
            echo "Invalid username or password!";
        }
    } else {
        echo "All fields are required!";
    }
}
?>
    </body>
</html>
member.php
<?php 
session_start();
if(!isset($_SESSION["sess_user"])) {
    header("location:login.php");
} else {
?>
    <!doctype html>
    <html>
        <body>
            <h2>Welcome, <?=$_SESSION['sess_user'];?>! <a href="logout.php">Logout</a></h2>
        </body>
    </html>
<?php } ?>
Database: https://i.stack.imgur.com/Eyfud.png

 
     
     
     
    