I have a PHP file named DBSettings.php with this information
<?php
$host="localhost";
$username="root";
$password="";
$db_name="DataBase_new";
$SideBarCondition="1";
?>
I have another php file where I include this php file
<?php
include('C:\xampp\htdocs\DBSettings.php');
class DbConnect {
public $con;
function __construct() {
define ("DB_HOST", $host);
define ("DB_USER", "User");
define ("DB_PASSWORD", "aasfafdf!34!");
define ("DB_DATABASE", "DB_new");
define ("DB_PREFIX", "");
}
}
but when I execute this I get the error
Notice: Undefined variable: host in C:\xampp\htdocs\project\editorpanel\common\main.php on line 9
I get the error on the line where I use the define ("DB_HOST", $host);. I have already defined the host variable in the DBSettings.php and have included that php file in my current file. So why am I getting this error?