I am trying to connect to my database; compare two columns in a row, and display the amount that is greater than "0.00"
The only one that is working is when the mb_accept column has a value greater than "0.00"
my ($mb_award,$mb_accept); $dbh=$db->prepare("SELECT mb_award,mb_accept FROM Items WHERE itemnum= +$form{'item'} AND seller=$fdnum AND closef='1'"); $dbh->execute(); ($mb_award,$mb_accept) = $dbh->fetchrow_array(); my $mb_amount_disp; if ($mb_award > "0.00") { $mb_award = $dbh=$db->prepare("SELECT mb_award FROM Items WHERE it +emnum=$form{'item'} AND seller=$fdnum AND closef='1'"); $dbh->execute(); $mb_amount_disp = $dbh->fetchrow_array(); } elsif ($mb_accept > "0.00") { $mb_accept = $dbh=$db->prepare("SELECT mb_accept FROM Items WHERE +itemnum=$form{'item'} AND seller=$fdnum AND closef='1'"); $dbh->execute(); $mb_amount_disp = $dbh->fetchrow_array(); }
Edit by thelenm: added code tags
janitored by ybiC: Retitle from "I'm not seeing it .. help please.." for future search-friendlyness
In reply to DBI compare columns problem by th3monk3y
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |