diff --git a/_posts/07-01-02-Interacting-via-Code.md b/_posts/07-01-02-Interacting-via-Code.md index 9414247..9f38be9 100644 --- a/_posts/07-01-02-Interacting-via-Code.md +++ b/_posts/07-01-02-Interacting-via-Code.md @@ -27,7 +27,7 @@ Consider the most basic step: {% highlight php %} query('SELECT * FROM table'); + return $db->query('SELECT * FROM table'); } foreach (getAllFoos() as $row) { @@ -63,16 +63,16 @@ include 'views/foo-list.php'; db = $db; - } + public function __construct(PDO $db) + { + $this->db = $db; + } - public function getAllFoos() { - return $this->db->query('SELECT * FROM table'); - } + public function getAllFoos() { + return $this->db->query('SELECT * FROM table'); + } } {% endhighlight %}