This code I have written is not putting the input into my database on MySQL. I watched a youtube video on how to make a registration form and this is the code (just trying to understand it better) but I don't know why mine isn't sending into my database.
PHP:
<?php
session_start();
// connect to database
$db = mysqli_connect("127.0.0.1", "root", "", "user logins");
if (isset($_POST['register_btn'])) {
    $firstName = mysql_real_escape_string($_POST['firstName']);
    $lastName = mysql_real_escape_string($_POST['lastName']);
    $emailAddress = mysql_real_escape_string($_POST['emailAddress']);
    $password = mysql_real_escape_string($_POST['password']);
    $password2 - mysql_real_escape_string($_POST['password2']);
}
if ($password == $password2) {
    // create user
    $password = md5($password); //hash password before storing for security
    $sql = "INSERT INTO user logins(firstName, lastName, emailAddress, password) VALUES('$firstName', '$lastName' '$emailAddress', '$password')";
    mysqli_query($db, $sql);
    $_SESSION['message'] = "You are now logged in";
    $_SESSION['username'] = $username;
    header('location: homepage.html'); //redirect to homepage
} else {
    $_SESSION['message'] = "The two passwords do not match";
}
?>
HTML:
<link rel="stylesheet" type="text/css" href="custom.css">
<body class="background">
<div>
    <h1 class="header1">Sign in Below</h1>
</div>
<div>
    <form action="connect.php" method="post">
        <div>
            <label for="firstName">First Name:</label>
            <input type="text" name="first_name" id="firstName">
        </div>
        <div>
            <label for="lastName">Last Name:</label>
            <input type="text" name="last_name" id="lastName">
        </div>
        <div>
            <label for="emailAddress">Email Address:</label>
            <input type="email" name="email" id="emailAddress">
        </div>
        <div>
            <label for="password">Password:</label>
            <input type="password" name="password" id="password">
        </div>
        <div>
            <label for="password2">Repeat Password:</label>
            <input type="password" name="password2" id="password2">
        </div>
        <input type="submit" name="register_btn" value="register">
    </form>
</div>
</body>