1<?php
2mysql_connect("db_host","db_user","db_pass");
3mysql_select_db("db_name");
4?>
Where db_host, db_user, db_pass and db_name is the host, username, password and name for your database respectively.
General practice is to save the code in a separate file in the ‘includes’ folder and including it on the page where you need it.
1<?php include("database.php") ?>