DEV Community

Discussion on: Database Level CRUD Operations Using PDO

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

Collapse
 
rizwan_saquib profile image
Saquib Rizwan

Your advice is Highly appreciated.!! Thanks

Collapse
 
vlasales profile image
Vlastimil Pospichal • Edited

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