Password Protected page not asking for a password

The answer to this question was simply that the built-in password protection does not apply if you are using a custom template that doesn’t include the_loop(). Lesson learnt.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)