Best practices for a PDO class?

KasynoHamn

New Member
I want to create a PDO class for handling data base connections.Here is what I have:\[code\]require('php/packages/store/store_db_settings.php');class store_pdo{ private $DBH; // Data Base Handler function __construct() { $DBH = new PDO(DB_DSN,DB_USER,DB_PASSWORD); } public function getHandler() { return $DBH; }}\[/code\]I think this seems ok, however I am used to just using things like \[code\]mysql_query\[/code\] and not really sure what problems I could run into in the future. So I thought the experience here could offer guidance.Is what I have sufficient? should I make my class Singleton, or use static functions? Is there a best practice?I don't want to go with this, then I after have several other classes using it, discover that I should have written it differently.P.S. I just noticed that the \[code\]best-practices\[/code\] tag is no longer allowed... does that mean questions like this are discouraged now too?
 
Back
Top