You've failed to close your prepare() statements with finish()
See the perldoc on DBI again.
Jaime Teng wrote:
>
> Hi,
>
> I have been pulling my hair due to this annoying error. x(
>
> ****************************************************************************
> DBI::db=HASH(0x1d2998c)->disconnect invalidates 1 active statement handle
> (either destroy statement handles or call finish on them before
> disconnecting)
> at C:\WEBSITE\script\default.pl line 721.
> ****************************************************************************
>
> It is a Perl CGI script and at line 721 is a simple disconnect command:
>
> 721 $DBH->disconnect;
> 722
> 723 binmode STDOUT;
> 724 print "Content-type: text/html\cM\cJ";
> 725 print "Content-length: ",length($HTTP),"\cM\cJ";
> 726 print "\cM\cJ";
> 727 print $HTTP;
>
> The error message is straight forward and means that I have an open
> mySQL handle that is not closed; example:
>
> $sth=$DBH->prepare("SELECT ......");
> $sth->execute;
> $DBH->disconnect; <--- should have been a fetch before disconnect.
>
> But I am dead sure I have a result collector:
> $sth=$DBH->prepare("SELECT ......");
> $sth->execute;
> $result = $sth->fetchrow;
>
> I only use three functions: prepare, execute and fetchrow.
>
> For all intents and purposes, I have reviewed the script line per line
> and even made sure that each select will give only one result by adding
> "LIMIT 1"
> $sth=$DBH->prepare("SELECT ...... LIMIT 1");
>
> arrrrrggggggggg!
>
> I am Perl built 626 on win2000. Mysql 3.23.37
>
> I have encountered this kind of errors on Linux+Apache before and I solved it
> via:
> $sth=$DBH->prepare("SELECT ......LIMIT 1");
> $sth->execute;
> while ( $result = $sth->fetchrow ) {1};
>
> It appeared to me that even if only one result is to be expected, mysql
> would throw more than one. or is this a problem with DBD-Mysql module?
>
> regards,
> Jaime
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php