I have config.php:
$mysqli = new mysqli($hostname, $user, $pass, $bd);
I include this config.php in all my website pages. eg
index.php
include("config.php");
include("functions.php");
...
in functions.php I have functions like this:
function get_name{
$stmt = $mysqli->prepare("SELECT * FROM users WHERE user=?");
}
my problem is, function get_name cant see $mysqli var. I need to include config.php inside get_name function (and all functions).
is there any other way to get $mysqli variable without need to include config.php in all functions?