in reply to Loop Question
As already mentioned, "=" will almost always evaluate as true (however, if $Data{"CustomerNumber"} evaluates as false, then the entire statement will be false).
First, print out the SQL.
Once you see the SQL, the error may be obvious. If not, try running the SQL manually and see what the results are.my $sql = "SELECT * FROM Cust_act_da WHERE CustomerNumber = $CustomerN +umber AND #TransType = P"; print $sql; $db->SQL( $sql );
Also, as a general rule, "select *" is generally not a good way to execute an SQL query (IMHO). It's not as efficient as selecting specifically what you want. Further, if the field names have been changed, this may obscure where your error is coming from.
Another thing that concerns me is that I see you are printing . This suggests that this information is being printed to a Web page. What is the original source of the data? Blindly printing data to a Web page doesn't usually cause problems (though someone could insert a meta refresh tag that redirects your page), but since you don't untaint this data, I am concerned about what else you may be doing with this data that may be dangerous.
Of course, that last comment is totally unrelated to your question, but I always harp about anything that suggests to me that a poor security model is being used. No offense. See perlsec for more information.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (Ovid) Re: Loop Question
by Anonymous Monk on Mar 21, 2001 at 21:47 UTC | |
by Ovid (Cardinal) on Mar 21, 2001 at 21:56 UTC | |
by Anonymous Monk on Mar 21, 2001 at 22:02 UTC |