DEV Community


Discussion on: Database Level CRUD Operations Using PDO

engineercoding profile image
Wesley Ameling

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 :)

rizwan_saquib profile image
Saquib Rizwan Author

Your advice is Highly appreciated.!! Thanks

vlasales profile image
Vlastimil Pospichal

Instead of method openConnection(), I use a parameterized constructor with a lazy database opening.