I have a php file, which connects to a mysql database using:
$mysqli = mysqli_connect("localhost","user","pass","db");
And on the same php, there are some functions that made use of that connection, and make querys...
I dont know how to set $mysqli to the entire php and call to it from functions, instead of repeating the connection on every function...
(I have 3 functions, i need to repeat the code of connection on every function, making at the end, 3 connections to the same database. I want to avoid that, and make one connection, and use it on the 3 functions without making another connection more.
Is there any way?
thanks