
Now without describing I am writing a PHP code here.
Here we will run the code by which we can connect to a database through PHP. Code is bellow:
<?php $conn_error = 'could not connect.' $mysql_host = 'localhost'; $mysql_user = 'root'; $mysql_pass = ''; $mysql_db = 'a_database'; @mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die($conn_error); mysql_select_db('$mysql_db') or die($conn_error); echo 'Connected!'; ?>