Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Error with the bind_param

by Win (Novice)
on Apr 04, 2007 at 11:10 UTC ( #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;


    New address of my CGI Course.

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


    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....


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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2021-11-28 00:31 GMT
Find Nodes?
    Voting Booth?

    No recent polls found