Fatal error: Undefined class name 'db' in C:\...\Apache2\htdocs\test\db2.php on line 9
| From: | Simons, Wouter | Date: | Mon, 22 Sep 2003 10:27:19 +0000 |
| Subject: | Fatal error: Undefined class name 'db' in C:\...\Apache2\htdocs\test\db2.php on line 9 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-7946@lists.php.net to get a copy of this message | ||
Hi All,
When using this code I receive a fatal error
<?php
include('dbinfo.php');
require_once( 'DB.php' );
$db = DB::connect( "mysql://$dbuser:$dbpass@$dbhost/$dbname" );
$sql = 'SELECT * FROM demo';
$demoResult = $db->query($sql);
while ($demoRow = $demoResult->fetchRow()) {
echo $demoRow[2] . '<br>';
}
$db->disconnect();
?>
The HTML page that is returned displayes the following
+++++++++++++++++++++++++++++++++++++++++++++++++++++
Record number 1
Record number 2
Record number 3
Record number 4
Record number 5
Fatal error: Undefined class name 'db' in C:\Program Files\Apache
Group\Apache2\htdocs\test\db2.php on line 9
+++++++++++++++++++++++++++++++++++++++++++++++++++++
I have a windows 2000 machine and on it are apache2, PHP4.3.3 and PEAR was installed using
go-pear.bat included with PHP. In my php.ini I have setup include_path to
include_path=".;C:\php\PEAR". The code has been taken from an article on PEAR. For the
article see this link http://www.phpbuilder.com/columns/allan20010115.php3
I have only just started using PEAR and am somewhat of a newbie. Could someone point me in the right
direction?
Thanks Wouter