Through PHP I form the table. It is required that this table be no more than 30 rows, although the sample from the database can be very large.
It is advisable to just have the entire sample on the client side but display 30 lines each. Also a convenient transition to another pile of records, also 30 lines each.

How comfortable is it to implement?

    2 answers 2

    If you need only 30 entries, do this:

    <? $db = new mysqli('localhost', 'root', '', 'dataase'); $query = $db->query('select * from posts order by id desc limit 30'); $query = $query->fetch_all(); echo '<table>'; foreach ($query as $item) { echo '<tr>'; echo '<td>' . $item[0] . '</td>'; echo '<td>' . $item[1] . '</td>'; echo '<td>' . $item[2] . '</td>'; echo '</tr>'; } echo '</table>'; 

    or make json_encode(array_chunk($query, 30)); .

    You can return such a json on the frontend and $.each() array through $.each() .

      jQuery plugin https://www.datatables.net/ - pagination, sorting and other buns.

      • mmm cool ATP. And if the pens do a theoretical implementation of what? - Raaur