Ay,
I defined (in config.php):
$mysql = mysqli_connect (..);
for connecting to the mySQL database. now I want to use the variable in my functions (functions.php):
function x () { $fetch = ($mysql, "SELECT ...")); }
without using global:
function x () { global $mysql ... }
any clean ideas (procedural)?
You can e.g. pass the connection resource to your function
function x ($mysqli) { $mysqli->... }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With