perl - DBD::mysql::st execute failed: called with 181 bind variables when 172 are needed -


i getting error

dbd::mysql::st execute failed: called 181 bind variables when 172 needed @ line 110, <$fh> line 1. 

i think problem lies within section of code

while ( $row = <$fh> ) {      chomp $row;      @dna = split('\|', $row);        $participant_id = $dna[0];     $participant_id =~ s/\>//g;      $array = $dna[1];      $length = length $array;      $array =~ tr/a-z/a-z/;     $array =~ s/(...)/$1 /g;      $array =~ s/\s+/,/g;      @dna1 =   split (',', $array);     unshift @dna1, $participant_id;      $sth4->execute(@dna1);  # line 110   }  $sth4->finish; 

with 172 placeholders assume sql statement has been produced automatically

you need @ code around like

my $sth4 = $dbh->prepare(...); 

which contains 172 placeholders ? whereas statement

my @dna1 = split (',', $array); 

results in @dna1 having 181 elements

the problem in these lines

$array =~ tr/a-z/a-z/; $array =~ s/(...)/$1 /g;  $array =~ s/\s+/,/g; 

which don't think do

show contents of $array (in new question) , describe transformation need , able help

by way, awful variable names. $array not array, , @dba1 .. database list .. thing, , has capital letters no reason


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -