Hello guys,
Please help me with debugging of following script:
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $dbh = DBI->connect('DBI:mysql:exim_mx1', 'root', 'PASSWORD') || die
"Could not connect to database: $DBI::errstr";
my $sth = $dbh->prepare('SELECT * FROM blackuser WHERE id=160') or die
"Can't prepare SQL statement: $DBI::errstr\n";
$sth->execute() or die "Can't execute SQL statement: $DBI::errstr\n";
my $result = $sth->fetchrow_hashref();
#print "Value returned: $result->{val}\n";
print $result;
#$dbh->commit or die $DBI::errstr;
$dbh->disconnect();
#$dbh->disconnect() or warn "Error disconnecting: $DBI::errstr\n";
exit;
Purpose of this script is connecting to localhost's mysqld server, USE
exim_mx1 database and make simple select.. but i don't know why it's not
working.. I have following error:
perl check2.pl
DBI::db=HASH(0x1e40ae0)->disconnect invalidates 1 active statement
handle (either destroy statement handles or call finish on them before
disconnecting) at check2.pl line 17.
HASH(0x1e40258)
Please, help
I use Debian 6.0.5 and perl 5.10.1
Best regards,
Dmitry Korzhevin
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/