Re: db asbstraction
| From: | Paul Meagher | Date: | Fri, 26 Jan 2001 04:20:22 +0000 |
| Subject: | Re: db asbstraction | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-1179@lists.php.net to get a copy of this message | ||
> Quoting Colin Viebrock <colin@easyDNS.com>:
>
> > $DB1 = new DB("SELECT name FROM table1");
> > $DB2 = new DB("SELECT age FROM table2");
>
FWIW, this is how I would tend to do it:
$dbh = new DB;
$sql1 = "SELECT name FROM table1";
$sth1 = $dbh->query($sql1);
$sql2 = "SELECT age FROM table2";
$sth2 = $dbh->query($sql2);
I started using $dbh (database handle) and $sth (statement handle) because
that is what the bundled regression tests use - which were the examples I
used to get started.
Regards,
Paul