Categories :

How to connect to mysqli database in php?

Create connection.php file and include all CRUD operation’s file for connect database.

$DB_HOST = 'localhost';
$DB_USER = 'root';
$DB_PASS = '';
$DB_NAME =  'mysql';
$conn = mysqli_connect($DB_HOST,$DB_USER,$DB_PASS,$DB_NAME);
// Check connection
if (!$conn) {
    echo "Failed to Connect to MySQL: " . mysqli_connect_error();
    echo "Success Connection to MySQL...!";

3 Replies to “How to connect to mysqli database in php?”

Leave a Reply

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