进账如何分页数据让说,如果有13个记录在第三页从DATABSE
最新的5或第二页9-13在第一页, 4-8和1-3我已经试过,但它的第一页只有
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mysqli_login";
// Create connection
$connection= new mysqli($servername, $username, $password, $dbname);
$query = mysqli_query($connection, "SELECT name,submittedby,trn_date FROM new_record ORDER BY id DESC LIMIT 5")or die(mysqli_error($connection));
while ($row = mysqli_fetch_array($query)) {
$fileName = $row['name'];
$fileContents = file_get_contents("txt/$fileName");
$poster = $row['submittedby'];
$date = $row['trn_date'];
echo ("posted by :$poster | posted date : $date");
echo ("$fileContents");
}
?>
您需要使用'LIMIT',但指定页面和偏移量 - 像'LIMIT 2,10'〜第2页共10条记录 – RamRaider