Solace Solace - 1 year ago 54
MySQL Question

Can I use a plugin to display (on front-end) first twenty of database rows at a time, and next twenty when user clicks "Next" button?

I have a database with a table having a big number of rows. I am fetching the data in this table and displaying it in an HTML table on a web page.

My requirement is to display 20 records initially and then when the user clicks a button labelled

, I show the next 20 records and so on...

So I have initially fetched first 20 rows from the table in my PHP (server-side), and then assigned a JS function to the
attribute of the
. Inside this JS function, I use an AJAX call which brings me the next 20 rows. Then within this JS function, I replace the HTML rows with these new rows.

I need something like this:

enter image description here

The question is that are there any plugins available which can implement that functionality for me? If a plugin is available, implementing it manually wouldn't make sense because being a rookie, I can't develop it better than the developers of that plugin.

Answer Source

This is called pagination - a quick search for "ajax pagination mysql php" or similar brings up a wide range of options. I can't recommend any particular one as your question is too broad.

Internally they use the MySQL LIMIT keyword.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download