This section of code is I am using to update password with token verification, I am getting useremail from url in encrypted format, that is why I have used md5 in query. The query is getting executed and affecting the table correctly, but it keep showing the else error message.
    $password= md5($_POST['password']);
    $sqlupdateaccount="UPDATE `mydatabasename`.`usertbl` 
                        SET `password`='$password' 
                        WHERE MD5(`useremail`)='$useremail' 
                        AND `token`='$token'";
    $result=mysqli_query($con,$sqlupdateaccount);
    if(mysqli_num_rows($result)>0)  // also used if(mysqli_affected_rows($con)) but still same problem
    {
        header("Location:userlogin.php?s=1");
    } else {
        echo "<h3 class='alert alert-danger'>Something Went Wrong</h3>".mysqli_error($con);
    }
 
     
    