I use a couple of functions to which I have to pass the name of the mysqli connection in order to fetch some data.
Is it safe to use a global variable for the mysqli connection to skip passing the connection name to the functions?

Recommended Answers

All 2 Replies

anybody?

Sure it is. As long as you don't have any includes or extensions that could access this global. My guess would be that you won't be including and malicious scripts on your site intentionally, so with the details you gave, I would say you're safe!
-PhpMyCoder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.