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

Error with the bind_param

by Win (Novice)
on Apr 04, 2007 at 11:10 UTC ( [id://608251]=perlquestion: print w/replies, xml ) Need Help??

Win has asked for the wisdom of the Perl Monks concerning the following question:

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: Error with the bind_param
by Ovid (Cardinal) on Apr 04, 2007 at 11:13 UTC

    That's because $sthB_A is undefined. The do() method will take a prepared statement, though.

    my $sthB_A = $dbh->prepare($Command_B); my $count = 1; foreach (@CHOICE_B[1 .. $elements_in_array_B]){ $sthB_A->bind_param($count, $_); $count++; } my $result = $dbh->do($sthB_A) or die "Couldn't do query: ".$dbh->err +str;

    Cheers,
    Ovid

    New address of my CGI Course.

Re: Error with the bind_param
by roboticus (Chancellor) on Apr 04, 2007 at 11:14 UTC
    Win:

    >Sigh<

    You need to actually have a statement handle to execute bind_param on it. You're trying to do your binding before you create it. Something like painting a house before you build it....

    ...roboticus

Re: Error with the bind_param
by davidrw (Prior) on Apr 04, 2007 at 11:53 UTC
    are you _sure_ @CHOICE_B[1 .. $elements_in_array_B] is what you want? Seems like it should be just @CHOICE_B ...

    You can also simplify the whole thing (see DBI docs) into one line:
    my $rv = $dbh->do($Command_B, {}, @CHOICE_B) or die "Couldn't do query +: ".$dbh->errstr;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (5)
As of 2024-03-19 03:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found