Scroll to load more data, suitable for pages such as comments
The database in this example is very simple, and it is clear at a glance
Copy code The code is as follows:
$query=mysql_query("select * from content order by id desc limit 0,10");
while ($row=mysql_fetch_array($query)) {
?>
js file
Copy code The code is as follows:
result.php
Copy code The code is as follows:
include("conn.php ");
$page = intval($_GET['page']); //Get the requested page number
$start = $page*5;
$query=mysql_query(" select * from content order by id desc limit $start,5");
while ($row=mysql_fetch_array($query)) {
$arr[] = array(
'content'=> $row['message'],
'author'=>$row['id'],
'date'=>date('m-d H:i',strtotime($row['updatetime ']))
);
}
echo json_encode($arr); //Convert to json data output
?>
http://www.bkjia.com/PHPjc/824846.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/824846.htmlTechArticleScroll to load more data, suitable for pages such as comments. The database in this example is very simple and can be understood at a glance. Copy the code. As follows: div id="container" ?php $query=mysql_query("select * from con...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn