Building a database class in PHP
- by Sprottenwels
I wonder if I should write a database class for my application, and if so, how to accomplish it?
Over there on SO, a guy mentioned it should be written as an abstract class. However, I can't understand why this would be a benefit.
Do I understand correctly, that if I would write an abstract class, every other class that methods will need a database connection, could simply extend this abstract class and have it's own database object? If so, how is this different from a "normal" class where I could instantiate an database object?
Another method would be to completely forget about my own class and to instantiate a mysqli object on demand.
What do you recommend?