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>'; } ?> 
  • 2
    Almost 20 years have passed from the 21st century, and they still write to Pkhp as if it were the 1990s now. It’s just amazing how old the old textbooks are. Here's how one of the variety of educational materials to stumble upon one that was written in the last century? - Ipatiev
  • one
    Your queries do not specify ORDER BY, and therefore the database returns rows in the order it wants. She has every right to return odd first. Well, the code must of course be revised. Especially determining the number of records in a table using mysqli_num_rows and even when sampling * , 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 obtained select count(*) from videos and only one digit from the database in php will come, but not all data - Mike
  • In addition to studying the old material, the most joke is that it is done by absolutely everyone who starts))) Where do you come from? Is there a sect like that? - singlesly
  • Well, give links to fresh and true materials, I also know how to crow in the comments. - Kanojis

0