Quick Search:
 
 Perl Code: Perl While Loop Example Jump to:  
Category: >> Perl Code >> Perl While Loop Example  

<< lastnext >>

Snippet Name: Perl While Loop Example

Description: If your SQL query will return more than one record, you will need to place the fetchrow() call in a while loop.

Comment: (none)

Language: PERL
Highlight Mode: PERL
Last Modified: March 05th, 2009

#!/usr/bin/perl
 
MY (@telephone);
MY $i = 0;
MY $count;
WHILE (@aRow = $sth->fetchrow())
{
    $telephone[$i] = @aRow[0];
    $i++;
}
$count = $i;
 
# @telephone can now be used to build an html table 
# to display all the telephone numbers in the "518"
# area code.
 


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org