Re: Probably a dumb question but I'm new to PEAR.
| From: | Malcolm Turnbull | Date: | Wed, 20 Mar 2002 16:10:26 +0000 |
| Subject: | Re: Probably a dumb question but I'm new to PEAR. | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-991@lists.php.net to get a copy of this message | ||
Jan,
Ok its a bit messy but here it is :
<HTML>
<BODY>
<?
include("DB.php");
$user='test';
$pass='test';
$host='localhost';
$db_name='test';
$dsn="pgsql://$user:$pass@$host/$db_name";
$db=DB::connect($dsn);
if (is_object($db)) {
print "\$db is an object<BR>\n";
}
if (is_resource($db->connection)) {
print "\$db is connected<BR>\n";
}
if (DB::isError($db)) {
print ("Sorry couldn't connect to DB...<BR>\n");
print ($db->getDebugInfo()."<BR>");
die ($db->getMessage()."<BR>");
}
print ("IT WORKED...");
$sql='SELECT forename from users2;';
print ("Query is : $sql <BR>\n");
$demoResult = $db->query($sql); // THIS IS THE LINE THAT CAUSES THE ERROR ?
/*
if (DB::isError($demoResult)){
print("Query caused us to DIE !");
die ($demoResult->getMessage());
}
*/
// echo $demoResult->fetchRow();
/*
while ($row = $demoResult->fetchRow()) {
echo $row[0];
}
*/
$db->disconnect();
print ("Disconnected OK...<BR>\n");
?>
</BODY>
</HTML>
Regards,
Malcolm Turnbull
Group IT Manager -
Crocus.co.uk Ltd &
Waterers Landscape PLC
01344 629661
07715 770523
www.crocus.co.uk - For all your Garden Needs
www.stealthinventory.com - The Open Source Software Audit Tool
----- Original Message -----
From: "Jan Lehnardt" <jan@php.net>
To: "Malcolm Turnbull" <malcolm.turnbull@crocus.co.uk>
Cc: <pear-general@lists.php.net>
Sent: Wednesday, March 20, 2002 3:57 PM
Subject: Re: [PEAR] Probably a dumb question but I'm new to PEAR.
> Hi,
> On Wed, 20 Mar 2002 15:49:39 -0000
> "Malcolm Turnbull" <malcolm.turnbull@crocus.co.uk> wrote:
>
> > http://www.castleinfo.co.uk/code/peartest.php
> can you please provide a full view to the script? Since the error is
> thrown in peartest.php it is not likely a bug in PEAR::DB.
>
> Jan
> --
> Q: Thank Jan? A: http://geschenke.an.dasmoped.net/
>