I am new to coding with php and I need help with this.
I have a config.php file with these values
<?php
define('DATABASE_HOST', 'localhost');
define('DATABASE_NAME', 'voltrun');
define('DATABASE_USERNAME', 'joy');
define('DATABASE_PASSWORD', 'salty');
?>
I have also a db.php file with these values
<?php require_once"../config.php";
echo 'DATABASE_HOST';
echo 'DATABASE_NAME';
echo 'DATABASE_USERNAME';
echo 'DATABASE_PASSWORD'
$db_host = 'DATABASE_HOST';
$db_user = 'DATABASE_USERNAME';
$db_password = 'DATABASE_PASSWORD';
$db_database = 'DATABASE_NAME';
$connection = mysqli_connect($db_host, $db_user, $db_password, $db_database);
if (!$connection) {
die('QUERY FAILED' . mysqli_error($connection));
}
?>
Any help on how to get the parameters from the config.php file into the db.php variables? As I still get Query Failed error.
Thanks for the help.