10.
OO Best Practice: Centralizing the Connection
Keep on Learning!
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
If you liked what you've learned so far, dive in! Subscribe to get access to this tutorial plus video, code and script downloads.
Whoops, an error! Please, try again later.
2 Comments
How the new PDO() function will know to connect to database if we removed this ???
Missing i am something ???
$pdo = new PDO($this->dbDns, $this->dbUser, $this->dbPass);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
Hey Miky
What we did here is just to move out the logic of creating a PDO object from
ShipLoaderto the outer script, but the new PDO object is being constructed with the same configuration. That's why everything still works the sameI hope it clarifies things a bit. Cheers!
"Houston: no signs of life"
Start the conversation!