How to change it so that the data is displayed on the page in reverse order, that is, the latest data is displayed at the front (code on the Internet)
肆意。
肆意。 2019-03-30 10:48:16
0
2
1332
<?php
//分页的函数
function news($pageNum = 1, $pageSize = 5)
{
$array = array();
// $coon = mysqli_connect('rm-bp108931c0786t58eko.mysql.rds.aliyuncs.com','jjadmin','jj960820-COM','table_jjf');
$coon = mysqli_connect('localhost','root','96jj0820com','shuju');
mysqli_set_charset($coon, "utf8");
// limit为约束显示多少条信息,后面有两个参数,第一个为从第几个开始,第二个为长度
$rs = "select * from news limit " . (($pageNum - 1) * $pageSize) . "," . $pageSize ;
$r = mysqli_query($coon, $rs);
while ($obj = mysqli_fetch_object($r)) {
$array[] = $obj;
}
mysqli_close($coon,"table_jjf");
return $array;
}
//显示总页数的函数
function allNews()
{
// $coon = mysqli_connect('rm-bp108931c0786t58eko.mysql.rds.aliyuncs.com','jjadmin','jj960820-COM','table_jjf');
$coon = mysqli_connect('localhost','root','96jj0820com','shuju');
mysqli_set_charset($coon, "utf8");
$rs = "select count(*) num from news"; //可以显示出总页数
$r = mysqli_query($coon, $rs);
$obj = mysqli_fetch_object($r);
mysqli_close($coon,"table_jjf");
return $obj->num;
}
@$allNum = allNews();
@$pageSize = 5; //约定每页显示几条信息
@$pageNum = empty($_GET["pageNum"])?1:$_GET["pageNum"];
@$endPage = ceil($allNum/$pageSize); //总页数
@$array = news($pageNum,$pageSize);
?>


肆意。
肆意。

reply all(1)
秋香姐家的小书童

1. SQL statement plus sorting You can sort by time or by auto-incrementing ID

2. I don’t see your website template and can’t guide you to output the information to the page

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template