List:General Discussion« Previous MessageNext Message »
From:Richard Reina Date:April 29 2000 2:45pm
Subject:query format question
View as plain text  
I am a newbie to linux, mysql, and perl -- and to programing in
general.  Over the past several months I have taught myself enough to
write a few scripts including the following one.  It works great except
for one thing.  When the output is greater than about twenty five rows,
all I see on the screen is the last twenty five or so rows.  How can
Iget the script to allow me to scroll back and forth through the ouput
or at least show me the output twenty five rows at a time?

Sample Output:
Quote
No.   Date       Orgin
Destination                             Rate     Miles
===== ========== =================== =================== ========
=======
70    2000-04-16 Kankakee         IL Cedar Rapids     IA   415.00
242.0 ...
79    2000-04-16 Kankakee         IL Cedar Rapids     IA   415.00
248.0 ...
96    2000-04-17 Columbus         OH Kankakee         IL   520.00
315.0 ...
1                            Kankakee         IL Columbus         OH
525.00   315.0 ...
59    2000-04-01 Kankakee         IL Bensalem         PA  1295.00
766.0 ...
88    2000-04-16 Kankakee         IL Bensalem         PA  1295.00
766.0 ...
73    2000-04-16 Kankakee         IL Yeadon               PA  1295.00
766.0 ...
72    2000-04-16 Kankakee         IL Dallas               TX  1045.00
862.0 ...
65    2000-03-31 Kankakee         IL Grand Prairie    TX  1165.00
8511.0 ...
75    2000-04-16 Kankakee         IL Laredo               TX  1995.00
1288.0 ...



        use DBI;
        my $db = DBI->connect("DBI:mysql:test",root,5492);
        my $query = "SELECT qteno, qtedate, orgcity, orgstate,
        dstcity,  dststate, price, miles
        FROM oldqts
        WHERE (custno = $SearchFor)
        ORDER BY dststate, dstcity";
        my $oldqts_output = $db->prepare($query);

        ($number, $date, $ocity, $ostate, $dcity, $dstate, $price,
         $miles);
        $oldqts_output->execute;
        $oldqts_output->bind_columns(\($number, $date, $ocity,
         $ostate, $dcity, $dstate, $price, $miles));
        while ($oldqts_output->fetch)  {
                write;
        }
        $db->disconnect;



format STDOUT_TOP =
Page @<<
$%

Quote
No.   Date       Orgin               Destination         Rate     Miles
===== ========== =================== =================== ========
.
format STDOUT =
@<<<< @<<<<<<<<<
@<<<<<<<<<<<<<<< @<
@<<<<<<<<<<<<<<< @< @####.##
@####.# ...
$number, $date, $ocity, $ostate, $dcity, $dstate, $price, $miles, $:
.





Thread
query format questionRichard Reina29 Apr
  • RE: query format questionbenjamin-weiss29 Apr