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



In reply to Re: (2) Need help with DBI by Anonymous Monk
in thread DBI compare columns problem by th3monk3y

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.