I am building this code to change the password of a simple login system (I know it isn't verry secure) Now I am coding the following bit of code but when I execute it it puts out an HTTP 500 error, so I checked it for errors but could not find any. I entered it in a PHP validator. Allso with no relult. Does any of you maybe know what I am not seeing right now?
<?php
session_start();
if (isset($_POST['updatepassword'])) {
    $user = $_POST['username'];
    $mysqli = new mysqli('localhost', 'creatalo_mika', 'Temppass100_', 'creatalo_lscdb') or die("verbinding error");
    $sql = $mysqli->query("SELECT * FROM users_table WHERE username='$user'") or die("selection error");
    $row = mysqli_fetch_assoc($sql);
    $dbpass = $row['password'];
    $newpass = $_POST['password'];
    $pass = $_POST['passwordold'];
    $passen = md5(md5('dsgf'.$pass.'sadf'));
    if ($passen == $dbpass) {
        $newpass = md5(md5('dsgf'.$newpass.'sadf'));
        $sql->query("UPDATE users_table SET password='$newpass' WHERE username='$user'") or die($mysqli->error);
        header("location: ../index.php ") or die($mysqli->error);
    } else {
        header("location: ../index.php#notgood ") or die($mysqli->error);
    }
}
 
    