bobione has asked for the wisdom of the Perl Monks concerning the following question:
#! perl -w use strict; use DBI; use DBD::mysql; # Connect DataBase my $dbh = DBI->connect('DBI:mysql:CCM', 'root', ''); ###### THIS DOESN'T WORK :( ##### # Prepare the SQL query for execution my $sth = $dbh->prepare(<<End_SQL) or die "Couldn't prepare statement: + $DBI::errstr; stopped"; SELECT f1, f2, f3, f4, f5, f6 FROM forum WHERE f1 = 10 End_SQL ###### THIS WORK FINE ##### # my $sth = $dbh->prepare(<<End_SQL) or die "Error: i$DBI::errstr; sto +pped"; # INSERT INTO forum values(10, "foo", "bar", "foobar", "barfoo", "barb +ar") # End_SQL $sth->execute() or die "Error: $DBI::errstr; stopped"; # Fetch each row and print it my ($f1, $f2, $f3, $f4, $f5, $f6) = $sth->fetchrow_array(); print STDOUT "$f1 $f2 $f3 $f4 $f5 $f6\n"; my $title = $sth->fetchrow_array(); print $title; # Disconnect Database $dbh->disconnect();
In fact, this may work but give me this error message:
DBI::db=HASH(0x1d2bae0)->disconnect invalidates 1 active statement handle (either destroy statement handles or call finish on them before disconnecting) at C:\WINDOWS\Profiles\bob\Desktop\ccm_forum.pl line 32.
That mean on the last line during DISCONNECT(). I don't really understand this message...
So I am searching for enlightement from The God PERL.
Thanks.
BobiOne KenoBi ;)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Error with SELECT and MySQL
by tachyon (Chancellor) on Jul 05, 2001 at 00:25 UTC | |
by bobione (Pilgrim) on Jul 05, 2001 at 01:01 UTC | |
Re: Error with SELECT and MySQL
by MZSanford (Curate) on Jul 05, 2001 at 11:10 UTC | |
Re: Error with SELECT and MySQL
by bobione (Pilgrim) on Jul 05, 2001 at 00:16 UTC | |
Re: Error with SELECT and MySQL
by tachyon (Chancellor) on Jul 05, 2001 at 00:23 UTC | |
by bobione (Pilgrim) on Jul 05, 2001 at 01:15 UTC |