Mysql Connection

<?php
	/* Your mysql server host name */
	$host = "localhost";
	
	/* Mysql database user name */
	$user = "root";
	
	/* Mysql database user password */
	$password = "yourpassword";
	
	/* Mysql database name */
	$database = "test";
	
	
	/* Open connection mysql server in mysqli procedural */
	$connect = mysqli_connect($host, $user, $password, $database);
	
	if($connect)
		echo "Connection Establish with database!";
	else
		die("Connection to the Server could not be established!");
	

	/* Open connection mysql server in mysqli object oriented */
	$connect = new mysqli($host,$user, $password, $database) or die("Connection to the Server could not be established!");
	if($connect)
		echo "<br />Connection Establish with database!"; 
?> 


/* Output */
Connection Establish with database!


Connection Establish with database!

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!