First, create a link using mysql_connect, and then use that link in the mysql_select_db function. Check the php manual for both of these functions, and you'll see examples of how this is implemented. If you aren't sure what I mean, post what you have, and we'll help you correct it.
$link = mysql_connect('localhost', $username, $password);
mysql_select_db($dbname, $link);