Nice article! However, why don't you make openConnection static so no object has to be created every time? The object itself does not add anything to the method itself.
On another note, I like to use a .ini file with specifications of the connect string. That way those details won't be hardcored and can be changed quite easily (usually also for a non-programmer).
I am a PHP Community Expert at Cloudways. I actively participate in contributing to open source project. Besides that, I also write a technical article on various blogs. I like traveling, gaming, r...
Nice article! However, why don't you make openConnection static so no object has to be created every time? The object itself does not add anything to the method itself.
On another note, I like to use a .ini file with specifications of the connect string. That way those details won't be hardcored and can be changed quite easily (usually also for a non-programmer).
Just adding my two cents :)
Your advice is Highly appreciated.!! Thanks
Instead of method openConnection(), I use a parameterized constructor with a lazy database opening.