Connecting PHP to Mysql
Connecting PHP to Mysql is very simple and easy to do.
What you need is to type code below into your php file:
$host = 'localhost';//host name, in this case we use localhost $user = 'root';//user name, in this case we use root $pass = 'password';//password, in this case we use password $conn = mysql_connect($host, $user, $pass) or die('Connection Failed');//will show "Connection Failed" if the connection failed $db_name = 'member';//declare the database that will be used mysql_select_db($db_name);//selecting the data base
Finish. We just done Connecting PHP to Mysql.