I can believe noone has mentioned MYSQLI and prepared statements yet, you may lock your password and database connection away, but thats ultimately futile if I can simply type ';DROP TABLE users;--
in the login form.
Check http://en.wikipedia.org/wiki/SQL_injection for an idea about what I'm talking about.