PEAR::DB accessing a MS SQL (SQL SERVER) DB Instance
| From: | Fortuno, Adam | Date: | Thu, 13 Nov 2003 22:04:30 +0000 |
| Subject: | PEAR::DB accessing a MS SQL (SQL SERVER) DB Instance | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-8893@lists.php.net to get a copy of this message | ||
All,
I'm having a hard time accessing a SQL Server instance using PEAR. I'm using
PHP 4.3.4 and Apache 1.3.2 on a Win2k Professional workstation. I'm trying
to access a SQL Server instance on a remote server using PEAR. When the code
executes, I receive an error reading
DB Error: extension not found. I
don't know what that really means. Is my PEAR install screwed? Is it a
connection issue? Here is my code (see below). If have any tips, I'd
appreciate it.
<?php
require_once ('DB.php');
$user = 'dev01';
$pass = 'devdev';
$host = 'db_dev';
$db_name = 'Northwind';
$dsn = "mssql://$user:$pass@$host/$db_name";
$sql = 'SELECT * FROM tbl_indiv';
$cnn = DB::connect($dsn);
if (DB::isError($cnn)) { die('<B>DB Connection:</B> ' .
$cnn->getMessage());
}
$q = $cnn->query($sql);
if (DB::isError($q)) { die('<B>Exec query: </B> ' . $q->getMessage()); }
echo '<TABLE><TR><TD>First Name</TD><TD>Last
Name</TD></TR>';
while ($q->fetchInto($row)) {
printf("<TR><TD>%s</TD><TD>%s</TD></TR>",
$row[1], $row[2]);}
$cnn->disconnect();
?>
Regards,
Adam Fortuno (x4904)
<<Adam Fortuno (E-mail).vcf>>