Dear,
I have my users timezone stored in the database. To access timezone I have a separate class which returns users timezone in various format.
In the timezone class I have two distinct functions for retrieving users timezone from the database. One of the function have database access and the other function dont have db access.
Some times when I want to get the users timezone with in a function from another class, which already have an open db connection I use the function in timezone class which does not have the db access.
Some times when I want to get the users timezone with in a function from another class, which does not already have an open db connection I use the function in timezone class which can create the db connection.
The reason why I do this is to avoid the creation of double db access connection.
Now my question is, am I correct in my thinking? or wrong because, with in an instance of a script once db access has been created the PHP engine wont allow another new connection with in the same function
I am novice and still trying to understand the fundamentals of good PHP programming.
Your help will be appreciated.
Thank you.