htmanning has asked for the wisdom of the Perl Monks concerning the following question:
So if the first record returns a $total=3 and the second record returns a $total= 6, how do I keep track and add them together so the total revenue is accurate.? I'm going in circles.$SQL = "select * from datbase where (TO_DAYS(NOW())-TO_DAYS(dateadded) +<1)"; # look for records less than 1 day old &Do_SQL; while ($pointer = $sth->fetchrow_hashref) { $total = $pointer->{'total'}; if ($total eq "3") { $revenue = 30; } elsif ($total eq "6") { $revenue = 60; } elsif ($total eq "10") { $revenue = 100; } } $sth->finish();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Adding numbers from a loop
by 1nickt (Canon) on Aug 06, 2019 at 22:41 UTC | |
by htmanning (Friar) on Aug 06, 2019 at 22:54 UTC | |
by stevieb (Canon) on Aug 07, 2019 at 00:03 UTC | |
by syphilis (Archbishop) on Aug 07, 2019 at 03:37 UTC | |
by 1nickt (Canon) on Aug 07, 2019 at 02:25 UTC | |
by tweetiepooh (Hermit) on Aug 07, 2019 at 11:58 UTC | |
|
Re: Adding numbers from a loop
by BillKSmith (Monsignor) on Aug 07, 2019 at 14:23 UTC |