MySQL database connection

This handy little script can be used as a function as required, or in an include. I have used this on virtually every site that uses a a database connection.