<?php
    $config = include('../../config.php');
    
    $MYSQL_DATABASE_NAME = $config['DB_NAME'];
    $MYSQL_HOSTNAME = $config['DB_HOSTNAME'];
    $MYSQL_USERNAME = $config['DB_ROOT_USERNAME'];
    $MYSQL_ROOT_PASSWORD = $config['DB_ROOT_PASSWORD'];

    // For debugging purposes, not to be used in production:
    // mysqli_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_ROOT_PASSWORD) or die(mysqli_error());
    mysqli_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_ROOT_PASSWORD);
    mysqli_select_db($MYSQL_DATABASE_NAME);
?>

<?php
    $MYSQL_DATABASE_NAME = "ehosp";
    $MYSQL_HOSTNAME = "localhost";
    $MYSQL_USERNAME = "root";
    $MYSQL_ROOT_PASSWORD = "rootpsswd";

    // For debugging purposes, not to be used in production:
    // mysqli_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_ROOT_PASSWORD) or die(mysqli_error());
    mysqli_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_ROOT_PASSWORD);
    mysqli_select_db($MYSQL_DATABASE_NAME);
?>

--- 
+++ 
@@ -1,8 +1,10 @@
 <?php
-    $MYSQL_DATABASE_NAME = "ehosp";
-    $MYSQL_HOSTNAME = "localhost";
-    $MYSQL_USERNAME = "root";
-    $MYSQL_ROOT_PASSWORD = "rootpsswd";
+    $config = include('../../config.php');
+    
+    $MYSQL_DATABASE_NAME = $config['DB_NAME'];
+    $MYSQL_HOSTNAME = $config['DB_HOSTNAME'];
+    $MYSQL_USERNAME = $config['DB_ROOT_USERNAME'];
+    $MYSQL_ROOT_PASSWORD = $config['DB_ROOT_PASSWORD'];
 
     // For debugging purposes, not to be used in production:
     // mysqli_connect($MYSQL_HOSTNAME, $MYSQL_USERNAME, $MYSQL_ROOT_PASSWORD) or die(mysqli_error());
Use variables from config.php configuration file
