How do you connet mysql database with PHP ?

We can create MySQL database with the use of :
mysql_create_db(“Database Name”)

We can connect Mysql Database with PHP using both Procedural and Object oriented style .

Following are the examples below:

$link = mysqli_connect(“localhost”, “UserName”, “Password”, “database name”);
$mysqli = new mysqli(“localhost”, “UserName”, “Password”, “database name”);

and in old type of connectivity we use:

$link = mysql_connect(“localhost”, “UserName“, “Password“);


Leave a Reply

Your email address will not be published. Required fields are marked *

twelve + 10 =