memberlogin
contactus
randomfacts

Connect to mysql database with php

Connecting to a mysql database with php is pretty easy - all that you need to know is the database_server_name (in this example it is localhost), username, password and the database name.  Then you simply use the mysql_connect function to connect to the database server and use the @mysql_select_db($database) command to connect to a particular database on the mysql server.

 <?

 $username = "db_username";
 $password = "db_password";
 $database = "database_name";
 mysql_connect(localhost,$username,$password);
 @mysql_select_db($database) or die( "Unable to select database");
?>