My Errors Are:
Notice: Undefined variable: sql in C:\xampp\htdocs\framework\frame.php on line 20
Notice: Undefined variable: sql in C:\xampp\htdocs\framework\frame.php on line 20
Notice: Undefined variable: sql in C:\xampp\htdocs\framework\frame.php on line 20
Notice: Undefined variable: sql in C:\xampp\htdocs\framework\frame.php on line 20
Notice: Undefined variable: dbC in C:\xampp\htdocs\login.php on line 17
Fatal error: Call to a member function query() on null in C:\xampp\htdocs\login.php on line 17
I have a file that includes another (PHP)
config.php:
$sql_host = "localhost";
$sql_user = "root";
$sql_pass = "";
$sql_databasename = "data";
Simple, right?
Now to frame.php:
require($_SERVER['DOCUMENT_ROOT'] . "/inc/config.php");
$sql = array(
"host" => $sql_host,
"user" => $sql_user,
"pass" => $sql_pass,
"dbid" => $sql_databasename,
);
foreach ($sql as $v){
if (!isset($v)){
die("ERROR: SQL LOGIN INVALID");
}
}
function connectSQL(){
$dbC = new mysqli($sql["host"], $sql["user"], $sql["pass"], $sql["dbid"]);
if ($dbC->connect_error){
die("SQL Error: " . $dbC->connection_error);
}
}
And I don't understand why this is happening? Any ideas?