Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: DBI Error

by BBQ (Curate)
on Jul 10, 2000 at 07:26 UTC ( [id://21749]=note: print w/replies, xml ) Need Help??


in reply to DBI Error

Just cleaning up the AM's post...
#!/usr/bin/perl print "Content-type:text/html\n\n"; use DBI; use CGI; $query = new CGI; my $dbh=DBI->connect('DBI:mysql:test','edward','password'); my $logname=$query->param('log'); my $passwd=$query->param('pass'); my $sth=$dbh->prepare(<<End_SQL); SELECT * from login where log = "$logname" End_SQL $sth->execute(); @row=$sth->fetchrow_array; $dbh->disconnect(); print <"TESTING</br>">; print "</body></html>";

Content-type:text/html DBI::db=HASH(0x81dc3e0)->disconnect invalidates 1 active statement han +dle (eithe r destroy statement handles or call finish on them before disconnectin +g) at ./new.response.cgi line 22.
Update:
BTW: I just noticed this. Is there any specific reason why you are not using placeholders with prepare? I'd do it this way...
$sth = $dbh->prepare(qq{ SELECT * from login where log = ? }) or die("Failed to prepare: $DBI::errstr\n"); $sth->execute($logname) or die("Failed to execute: $DBI::errstr\n");
Be lazy, and let DBI quote for you, its easier! :)

#!/home/bbq/bin/perl
# Trust no1!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://21749]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2024-04-23 12:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found