There should be a simple output of all values by id from the table with further page-by-page breakdown, but some nonsense is obtained, only odd ones are output. What can you say? Do not kick much, please.
require_once '/include/connection.php'; $mysqli = new mysqli($host, $user, $password, $database); if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } $mysqli->set_charset('utf8'); $quantity = 3; $limit = 3; $page = $_GET['page']; if(!is_numeric($page)) $page=1; if ($page<1) $page=1; $result2 = $mysqli->query("SELECT * FROM videos"); $num = mysqli_num_rows($result2); $pages = $num/$quantity; $pages = ceil($pages); $pages++; if ($page>$pages) $page = 1; if (!isset($list)) $list=0; $list=--$page*$quantity; $result = $mysqli->query("SELECT * FROM videos LIMIT $quantity OFFSET $list"); $num_result = mysqli_num_rows($result) <? for ($i = 0; $i<$num_result; $i++) { $row = mysqli_fetch_array($result); print '<div class="col-lg-2 col-md-3 col-sm-6 col-6 mb-4"> <!--Card--> <div class="card"> <!--Card image--> <div class="view overlay"> <img src="/1.jpg" class="card-img-top" alt=""> <a href="'.$row->url.'"> <div class="mask rgba-white-slight waves-effect waves-light"></div> </a> '.$result->id.' </div> </div> <!--/.Card--> </div>'; } ?>
*
, i.e. all columns. You understand that for the sake of counting the number you actually request the entire table from the database, download it entirely in php buffers and then consider it. Learn sql, for example, the number can be obtainedselect count(*) from videos
and only one digit from the database in php will come, but not all data - Mike