in reply to Re: DBI compare columns problem
in thread DBI compare columns problem
Hi all,
thanks for your replies. You have to forgive me; I am very new to perl !! And to add insult to injury, I had stepped away from it for a while ... other projects!
my first post is what I had ended up with after many, many failed attempts. Originally I had.
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_amount_disp = $mb_award;
}
elsif ($mb_accept > "0.00") {
$mb_amount_disp = $mb_accept
I was thinking I was "using up my variable" somewhere ..... so I put the same query in again. it is strange that this is only working for the mb_accept column...
I am using MySql for the database and the default values for the two columns are 0.00 . Entries will be made in the rows mb_accept or mb_award; never both! I need this bit of code to see which row the entry has been made in, and then display the amount. I tried using edoc's snippet ...
if ($mb_award > 0) {
$mb_amount_disp = $mb_award;
} elsif ($mb_accept > 0) {
$mb_amount_disp = $mb_accept;
}
but i still end up with the same result! Nothing... it doesn't even display the default value 0.00
thanks again,
-paul
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (3) DBI compare columns problem
by Roger (Parson) on Sep 17, 2003 at 08:53 UTC | |
by shenme (Priest) on Sep 17, 2003 at 18:08 UTC | |
|
Re: (3) DBI compare columns problem
by hmerrill (Friar) on Sep 17, 2003 at 13:13 UTC | |
by Anonymous Monk on Sep 17, 2003 at 19:25 UTC | |
by th3monk3y (Novice) on Sep 17, 2003 at 22:14 UTC |