how to do Database Connection in PHP

Before you can get content out of your MySQL database, you must know how to establish a connection to MySQL in a PHP script. To run basic queries from within MySQL is very easy.

This post will show you how to get up and running.


	define('DB_SERVER', "localhost");
	define('DB_USER', "root");
	define('DB_PASS', "");
	define('DB_DATABASE', "whatsapp");
	$con = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);

	//to check connection is establish or not.
		echo "connection error";

Leave a Reply

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