Re: Fwd: [PHP-DB] MySQLi connections

[email protected] ("J. Hill")
Newsgroups php.db
Message-ID <[email protected]>
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?

Thanks,

Jeff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.