How to make pagination of records in php?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
16 views
There is a script output of the news but they all appear at once how to do something they would be displayed on the pages, such as what would be on each page were not more than 10 news.
Script output:
$page = $_GET['page']; if (!isset($page)) { $command = mysqli_query($connection, "SELECT * FROM `news` ORDER BY ID DESC"); require 'pages/news.php'; }


news.php:
Latest news<?php$empn = mysqli_num_rows($command);if ($empn == 0) {echo "<div class='empn'>News at the moment! Stay tuned."; } else { foreach ($command as $key => $itm): $valdesc = iconv_strlen($itm['desc']); $text = mb_substr($itm['desc'],0,1069, 'UTF-8'); $textt = $text . "..."; ?> <?php echo $itm['name']; ?><?php echo $itm['date']; ?><?php if ($valdesc > 1069) { echo $textt; } else { echo $text; } ?><?phpif ($valdesc > 1069) { ?> To open fully<?php}?><?phpendforeach;}?>
by | 16 views

1 Answer

0 like 0 dislike
If you need to output 10 records, what to get from dB all? Google Mysql limit
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users