Reading the thread on mysqli connection issues, I am curious if anyone knows of a downside to creating a connection from a configuration page and using it as a global in all functions?

I am used to creating a class and a database handle for functions to use, but I inherited an intranet that just uses a single "$mysqli = mysqli_connect ...." in a global main file and the just uses "global $mysqli" in all of it's functions (several hundred) that interact with the database.

Since I have not seen this structure used elsewhere, I assume there is a good reason not to use it, but I haven't found one (except for the security issue in the use of globals).

Could anyone point me towards any documentation on why such a structure is bad?



PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to