javascript - how to display only 100 rows of 1000 from a database with options to go to next 100 and previous 100 in html/php/css/js -
so here wana wana display first 100 rows database has total of 1000 or more rows.
now displaying of them can create problems in locating particular row.
so wana display first 100 option go next/previous etc, kinda in google search result..
see pic:
http://tinypic.com/r/34xl5rc/5
http://tinypic.com/view.php?pic=15q3k49&s=5
how can done.. please give sample code/links usefull
as stated in other answers, you're trying called pagination. can done javascript/jquery or solely php. jquery code here. in php, you'd following.
- execute sql statement of results database , put them array.
- divide number of elements in array many results want per page (100 in case). if have 1000 records , divide 100 results per page, you'd 10 pages.
- each page link correspond set of results submitted on click. can making post or request (post recommended). example, link page 1 results 0-99, page 2 results 100-199, etc.
- now when user clicks page link, post results, , can use parameters adjust sql statement based on page link clicked on. essentially, should modify limit part of sql statement. example, if user clicks page 2, limit clause in sql statement go being
limit 0,100on page 1limit 100,100page 2, , on.
Comments
Post a Comment