peppiv has asked for the wisdom of the Perl Monks concerning the following question:
Obviously, I want (for formatting purposes) to write each response to it's own table row (three columns wide).my $sth = $dbh->prepare('SELECT COUNT(*) FROM owner WHERE rent_ca +r = "Y"'); $sth->execute() or die $sth->errstr; my $rent_car = $sth->fetchrow_array(); my $percent = ($rent_car / $result)*100; printf qq(<tr><td>Yes</td><td>$rent_car</td><td align="right"> +%.2f%%</td></tr>\n),$percent; my $sth = $dbh->prepare('SELECT COUNT(*) FROM owner WHERE rent_ca +r = "N"'); $sth->execute() or die $sth->errstr; my $rent_car2 = $sth->fetchrow_array(); my $percent2 = ($rent_car2 / $result)*100; printf qq(<tr><td>No</td><td>$rent_car2</td><td align="right"> +%.2f%%</td></tr>\n),$percent2; my $rent_carno = $rent_car + $rent_car2; my $rent_carnor = $result - $rent_carno; my $percent3 = ($rent_carnor / $result)*100; printf qq(<tr><td>No Response</td><td>$rent_carnor</td><td ali +gn="right">%.2f%%</td></tr>\n),$percent3;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl - MySQL query question
by gmax (Abbot) on Mar 08, 2002 at 16:20 UTC | |
|
Re: Perl - MySQL query question
by talexb (Chancellor) on Mar 08, 2002 at 16:33 UTC | |
|
Re: Perl - MySQL query question
by fuzzyping (Chaplain) on Mar 08, 2002 at 17:05 UTC | |
|
Re: Perl - MySQL query question
by mugwumpjism (Hermit) on Mar 08, 2002 at 16:30 UTC |