Scroll to load more data, suitable for comments and other pages
The database of this example is very simple and it is clear at a glance
Copy CodeThe 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 CodeThe code is as follows:
result.php
Copy CodeThe code is as follows:
Include ("conn.php");
$page = intval ($_get[' page '); Gets the number of pages requested
$start = $page;
$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.html www.bkjia.com true http://www.bkjia.com/PHPjc/824846.html techarticle scrolling load more data, suitable for comments and other pages The database of this example is very simple, a look at the copy code is as follows: Div id= "container"? PHP $query =mysql_query ("select * from con ...