I see the issue. The problem stems from you using a session variable that is set on the login page from the database and displaying it.
The values set from the login page aren't encoded by default like values displayed from the recordset are. I think the best solution would be to just add the encoding when the value is displayed. So on line 170 of my-account.php instead of:
echo $arr[0];
use:
echo htmlspecialchars($arr[0]);