/    Sign up×
Community /Pin to ProfileBookmark

Results Per Page – Next Page Please -: CGI OutPut :-

I am working on a script to open a data file and print the lines in the file, with a url and description.

I can output the file, but the entire file outputs. over 4000 links to other websites. I want to limit this out put to about 50 to 100 links per page.

Again, I can output the data the way I want it, but can not limit it and return a next or a list of pages, that may follow such as 1 2 3 4 >>>Next Page etc.

This is the output loop:

foreach my $i (@grok) {
chomp($i);
my ($title,$url,$status,$cat) = split(/|/,$i);
if ($status ne “OUT”) {
print “<a href=”$url”><font face=Arial,helvetica,vedana size=3 color=#083194><b>”$title”</b></font></a><p>n”;
}
}

What can I do or how do I limit this and return so many results per page and enumerate the rest of the pages in sequence?

Thanks,
Nick

to post a comment
Full-stack Developer

2 Comments(s)

Copy linkTweet thisAlerts:
@bathurst_guyAug 30.2005 — in your sql have LIMIT 0, 50 for the first page, check if there are further results, etc, if more the next page sql LIMIT 51, 100

Thats my guess.
Copy linkTweet thisAlerts:
@ray326Aug 30.2005 — Always drive back through the same script.

Run the line output loop through some maximum number of lines each time.

Keep track of the starting line number in the file.

Open the file, seek to the starting line, read at most the max number of lines into a string array, loop the array for output.

Pass the appropriate line numbers for navigation in a query string in the prev/#/#/#/#/next links.
×

Success!

Help @NicSab spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...