Kiko has asked for the wisdom of the Perl Monks concerning the following question:
Hey, I left this program alone for a while and now i'm working on it again. I'm trying to view the first 100 records from a database and then display the next 100 and so on. I'm able to display the first 100 but i don't know how to show the next 100. This is the section of my program that's supposed to do this: my ($row)=0; my ($count)=0; my ($min)=0; my ($max)=$min+100; while ($db->FetchRow()) { if(($row>=$min)&&($row<$max)) { my (%dbrow) = $db->DataHash(); $dbrow{'details'}=substr($dbrow{'details'},0,50); print<<HERE_HTML_ROW; <td bgcolor="$recordbg"><font face="arial" size="1">$dbrow{'la +stname'}, $dbrow{'firstname'} </font> </td> <td bgcolor="$recordbg"><font face="arial" size="1">$dbrow{'of +ficephonenumber'} </font> </td> <td bgcolor="$recordbg"><font face="arial" size="1">$dbrow{'de +scription'} </font> </td> <td bgcolor="$recordbg"><font face="arial" size="1">$company_t +ype </font> </td> <td bgcolor="$recordbg"><font face="arial" size="1">$dbrow{'co +mpany_name'} </font> </td> <td bgcolor="$recordbg"><font face="arial" size="1">$dbrow{'de +tails'} </font> </td> HERE_HTML_ROW print "\n</tr>\n"; } $row++; $count++; } print "\n</table>\n"; my ($visible); if ($count>=$max){ $visible=$max; } else { $visible=$count; } print<<HERE_HTML; <BR><font size="2" face="helvetica"><B>1-$visible of $count records di +splayed</B></font> HERE_HTML # This is the part that's not working because i don't think # that i can do this, please help. if ($row>$max) { print "<font size=2 face=helvetica><a href=\"$ENV{'SCRIPT_NAME'}?$ +ENV{'QUERY_STRING'}&min=100\">Next 100</a></font>\n"; } Thanks, Kiko
|
---|
Replies are listed 'Best First'. | |
---|---|
RE: Viewing
by merlyn (Sage) on Aug 16, 2000 at 22:21 UTC | |
Re: Viewing
by Speedfreak (Sexton) on Aug 17, 2000 at 12:00 UTC | |
Re: Viewing the first 100 records, then the next 100.
by Kiko (Scribe) on Aug 16, 2000 at 22:09 UTC | |
Re: Viewing
by Kiko (Scribe) on Aug 17, 2000 at 01:08 UTC | |
by merlyn (Sage) on Aug 17, 2000 at 02:08 UTC |
Back to
Seekers of Perl Wisdom