First is the usual discomfort at seeing values interpolated directly into the SQL statement, rather than using placeholders. Are you sure that $form{'item'} and $fdnum don't contain any spaces or apostrophes or something else that your SQL engine make think is something other than a value? For that matter, do you need apostrophes surrounding those two variables?
Second is the strange use of 'handle' variable names. I can see that $db is apparently your DBI database handle returned from connect(). Often people use $dbh for that handle value, and use something else for the statement handle. Using $dbh instead of $sth for a statement handle causes a little queasiness for me.
Another thing that confuses me is that all the SQL statements are the same, at least as shown in your example. What different behavior did you think you would get?
Enough blathering from me. Why don't you back up and just check the results from your first prepare/execute/fetch set of statements. Let's see, untested code ahead:
my ($mb_award,$mb_accept); $db->{RaiseError} = 1; # turn on error checking\ my $sth=$db->prepare( "SELECT mb_award,mb_accept FROM Items WHERE it +emnum=? AND seller=? AND closef='1'" ); $sth->execute($form{'item'},$fdnum); ($mb_award,$mb_accept) = $sth->fetchrow_array(); print " We see '$mb_award' and '$mb_accept'\n";
In reply to Re: DBI compare columns problem
by shenme
in thread DBI compare columns problem
by th3monk3y
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |