pagination in php [closed]

2019-09-08 03:17发布

问题:

want search result for displaying exactly same result as in : https://www.ippu.purdue.edu/GlobalLinkages/index.cfm?Location=.&Page=search

1 - 25 of 414 records Next >

I am using 3 inputs frm user ant it is same as link provided above

回答1:

Use MySQL's LIMIT and OFFSET constructs:

$offset = ($current_page - 1) * $items_per_page;
// in your query:
LIMIT $items_per_page OFFSET $offset


回答2:

I'd check out the Pager class in the PEAR repository. It's what I use for this sort of thing, and it has a bunch of options you can set.