I have an SQL table table taking care of the members list of my website. However, when registering a new user, the data is not inserted in the table. No error is being shown either as I check for them a few times throughout my code.
if (empty($error_msg)) {
        // Create hashed password using the password_hash function.
        // This function salts it with a random salt and can be verified with
        // the password_verify function.
        $password = password_hash($password, PASSWORD_BCRYPT);
        // Insert the new user into the database 
        if ($insert_stmt = $mysqli->prepare("INSERT INTO members (username, email, password) VALUES (?, ?, ?)")) {
            $insert_stmt->bind_param('sss', $username, $email, $password);
            // Execute the prepared query.
            if (!$insert_stmt->execute()) {
                header('Location: ./error.php?err=Registration failure: INSERT');
            }
            header('Location: ./register_success.php?');
        }
    }
The code executes to the end and I am redirected to register_success. I know it's not because I have entered the wrong data base credentials as somewhere ele in my code, I am sending data to the same database with the same credentials(they're kept in another file) and it works perfectly fine.
EDIT: After removing the second "header" as Nick Coons said, I'm getting redirected to the error page meaning there's a problem with the execute. Still, I've got no idea why...
 
    