<div>I'm workng input form and catalyst search funtion with DBIx::Class base model, and found this strange behavior.</div> <div>On my input form, there are 7 or more (the form is built dinamically) selection boxes which contains the values : T, F or NA(not null). In the controller, the search string is:</div> <div> </div> <div>my $val1;</div> <div>my $val2; ... my $val7;</div> <div>my $phrase1; .... my $phrase7;</div> <div>if($val1 eq "NA"){$phrase1="val1 is not null";} else{$phrase1 = "val1='$val1'";}</div> <div>....</div> <div> </div> <div>my $searchstring = $phrase1." and ".$phrase2." and ".$phrase3." and ".phrase4." and ".$phrase5." and ".$phrase6." and ".$phrase7;</div> <div> </div> <div>my $rs = [$c->model('myApp::Mytabe')->search( \$searchstring); </div> <div># search result is the same for ($searchstring) or ("${searchstring}")</div> <div> </div> <div>The strang behaviour is:</div> <div>if on the form I
select less than or equal 3 boxes from val1 to val3 = na, the result returned right. But if I select more than 4 boxes with the val=na, or even 1 box val7=na, catalyst returns error "there is an error in your SQL syntax: .... select val1,val2, ....val7 where val1='T' and val7 is not null and val2='T' and val3='T' and val4 ........ and val6='T' and )</div> <div>Please pay attention at the last "and", because the val7 is move next to val1. and this cause the syntax error.</div> <div>If the form less that 4 selection box, everything is fine.</div> <div> </div> <div>Any one could tell me why I get this error. The string is screwed up.</div> <div> </div> <div>Thank you</div><p> 
<hr size=1>Need a quick answer? Get one in minutes from people who know. Ask your question on
<a href="http://answers.yahoo.com/;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx">Yahoo! Answers</a>.