复制代码 代码如下:

<div id="containe">

Home >Backend Development >PHP Tutorial >Dynamically load data without refreshing. Scroll bar loading is suitable for pages such as comments_PHP tutorial

Dynamically load data without refreshing. Scroll bar loading is suitable for pages such as comments_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:26:01762browse

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
Dynamically load data without refreshing. Scroll bar loading is suitable for pages such as comments_PHP tutorial

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)) {
?>


< /div>


< div class="content">






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
?>

www.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