function connect(){
if(!$db = mysql_connect("microsoft.com", "user_name", "Password")):
print("<h1> Can't Connect to the DB!</h1>\n");
else:
mysql_select_db("try", $db);
echo " it as been connented";
endif;
}
call this function.
connect();
hope this work for you +)