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.
Example
<?php
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.
if(!$con)
{
echo "connection error";
}
?>