Help me with this code: I get this error.
Notice: Undefined variable: dbCon in C:\xampp\htdocs\Project\core\functions\general.php on line 5
Warning: mysqli_real_escape_string() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Project\core\functions\general.php on line 5
Notice: Undefined variable: dbCon in C:\xampp\htdocs\Project\core\functions\Users.php on line 5
Warning: mysqli_query() expects parameter 1 to be mysqli, null given in C:\xampp\htdocs\Project\core\functions\Users.php on line 5
Fatal error: Uncaught Error: Call to undefined function mysqli_result() in C:\xampp\htdocs\Project\core\functions\Users.php:8 Stack trace: #0 C:\xampp\htdocs\Project\login.php(4): user_exists(NULL) #1 {main} thrown in C:\xampp\htdocs\Project\core\functions\Users.php on line 8
Main folder(name -> PHP) has Index.php:
<?php
include 'core/init.php';
include 'includes/overall/header.php';
?>
PHP folder has Login.php:
<?php
include 'core/init.php';
if(user_exists('sudin') === true)
{
echo 'exists';
}
?>
under php/core folder init.php:
<?php
session_start();
require 'database/connect.php';
require 'functions/general.php';
require 'functions/users.php';
?>
under php/core/database connect.php:
<?php
$dbCon=mysqli_connect('localhost','root','','project_point');
?>
under php/core/functions Users.php:
<?php
function user_exists($username)
{
$username = sanitize($username);
$query = mysqli_query($dbCon,"SELECT COUNT('Login_ID')FROM 'login' WHERE 'Username' = '$username'");
return(mysqli_result($query,0)==1) ? true : false;
}
?>
under php/core/functions general.php:
<?php
function sanitize($data)
{
return mysqli_real_escape_string($dbCon,$data);
}
?>[enter image description here][1]
Sorry for the messy way, here is the treeview:
Thankful for the help