Re: Pear Db layer
| From: | KOYAMA Tetsuji | Date: | Sat, 30 Sep 2000 13:18:29 +0000 |
| Subject: | Re: Pear Db layer | ||
| References: | 1 | Groups: | php.pear |
| Request: | Send a blank email to php-pear+get-302@lists.php.net to get a copy of this message | ||
At Sat, 30 Sep 2000 13:55:34 +0100,
Richard Heyes <php@heyes-computing.net> wrote:
>
> Is the abstraction layer complete enough to use? If so has anyone some
> example usage?
I'm using PEAR DB classes now, with PHP-4.0.2, PostgreSQL-7.0.2,
and FreeBSD-4.1.
Example:
require_once( "DB.php" );
$db = DB::connect( "pgsql://localhost/dbname" );
$sql = "select * from tablename";
$result = $db->query( $sql );
$counter = 1;
while ($row = $result->fetchRow()) {
echo $counter++ . ": ";
for ($i = 0; $i < count( $row ); $i++) {
echo "$row[$i] ";
}
echo "<br>";
}
--
koyama@hoge.org
koyama@beatraft.com
KOYAMA Tetsuji BeatCraft, Inc., Tokyo, Japan.