Php+jquery realization of the dynamic loading data function without refreshing the scroll screen

Source: Internet
Author: User
Tags echo date php database
This article mainly introduces the Php+jquery implementation of rolling screen without refreshing dynamic loading data, involving PHP dynamic reading database and loading data to achieve scrolling without refreshing effect of the specific operation skills, the need for friends can refer to the next

Specific as follows:

index.php

<?phprequire_once (' connect.php '); Connect database $user = Array (' Demo1 ', ' Demo2 ', ' Demo3 ', ' Demo3 ', ' <de></de>mo4 '); How many users did you simulate? ><! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

Ajax_demo.sql

--phpMyAdmin SQL dump--version 3.5.2.2--http://www.phpmyadmin.net----Host: localhost--generated: January 18, 2015 15:56--Service Device version: 5.1.46-community--PHP version: 5.2.13SET sql_mode= "No_auto_value_on_zero"; Set time_zone = "+00:00";/*!40101 set @OLD_CHARACTER_SET_CLIENT =@ @CHARACTER_SET_CLIENT */;/*!40101 set @OLD_CHARACTER_ set_results=@ @CHARACTER_SET_RESULTS */;/*!40101 SET @OLD_COLLATION_CONNECTION =@ @COLLATION_CONNECTION */;/*!40101 SET NAMES UTF8 */;----Database: ' demo '----------------------------------------------------------------table structure ' say '--create TABLE IF not EXISTS ' say ' (' id ' int (one) not null auto_increment, ' userid ' int (one) ' NOT null DEFAULT ' 0 ', ' content ' varchar  () not NULL, ' addtime ' int (ten) not NULL, PRIMARY KEY (' id ')) engine=myisam DEFAULT Charset=utf8 auto_increment=63;---- Dump the data in the table ' say '--insert into ' say ' (' id ', ' userid ', ' content ', ' Addtime ') VALUES (1, 0, ' Love love Love ', 1421332482), (2, 1, ' Love love ', 142 1332482), (3, 0, ' Love love Love ', 1421332482), (4, 1, ' Love love Love ', 1421332482), (5, 0, ' Love love Love ', 1421332482),(6, 0, ' Love love Love ', 1421332482), (7, 0, ' Love love ', 1421332482), (8, 2, ' Love Love ', 1421332482), (9, 0, ' Love love Love ', 1421332482), (10, 0, ' Love love ', 142 1332482), (11, 0, ' Love love Love ', 1421332482), (12, 0, ' Love love Love ', 1421332482), (13, 0, ' Love love Love ', 1421332482), (14, 0, ' Love love Love ', 1421332482), (15, 0, ' Love love Love ', 1421332482), (16, 0, ' Love love Love ', 1421332482), (17, 0, ' Love love Love ', 1421332482), (18, 0, ' Love love Love ', 1421332482), (19, 0, ' Love love ', 1421 332482), (20, 0, ' Love love Love ', 1421332482), (21, 0, ' Love love Love ', 1421332482), (22, 0, ' Love love Love ', 1421332482), (23, 0, ' Love love Love ', 1421332482), (24, 0 , ' Love love Love ', 1421332482), (25, 0, ' Love love Love ', 1421332482), (26, 0, ' 2222 ', 1421333156), (27, 0, ' 2222 ', 1421333159), (28, 0, ' 2222 ', 14 21333161), (29, 0, ' 2222 ', 1421333162), (30, 0, ' 2222 ', 1421333164), (31, 0, ' 2222 ', 1421333165), (32, 0, ' 2222 ', 1421333167), (33, 0, ' 2222 ', 1421333168), (34, 0, ' 2222 ', 1421333169), (35, 0, ' 2222 ', 1421333170), (36, 0, ' 2222 ', 1421333172), (37, 0, ' 2 222 ', 1421333173), (38, 0, ' 2222 ', 1421333175), (39, 0, ' 2222 ', 1421333176), (40, 0, ' 2222 ', 1421333177), (41, 0, ' 2222 ', 1421 333178), (42, 0, ' 2222 ',1421333179), (43, 0, ' 2222 ', 1421333181), (44, 0, ' 2222 ', 1421333182), (45, 0, ' 2222 ', 1421333183), (46, 0, ' 2222 ', 1421333184 ), (47, 0, ' 2222 ', 1421333293), (48, 0, ' 2222 ', 1421333295), (49, 0, ' 2222 ', 1421333296), (50, 0, ' 2222 ', 1421333297), (51, 0, ' 2222 ', 1421333298), (52, 0, ' 2222 ', 1421333299), (53, 0, ' 2222 ', 1421333300), (54, 0, ' 2222 ', 1421333302), (55, 0, ' 2222 ', 14 21333303), (56, 0, ' 2222 ', 1421333304), (57, 0, ' 2222 ', 1421333305), (58, 0, ' 2222 ', 1421333306), (59, 0, ' 2222 ', 1421333308), (0, ' 2222 ', 1421333309), (0, ' 2222 ', 1421333310), (0, ' 2222 ', 1421333311);/*!40101 SET character_set_client= @OL D_character_set_client */;/*!40101 Set character_set_results= @OLD_CHARACTER_SET_RESULTS */;/*!40101 set Collation_ connection= @OLD_COLLATION_CONNECTION * *;

result.php Receive Request page

<?phprequire_once (' connect.php '); Connect database $user = Array (' Demo1 ', ' Demo2 ', ' Demo3 ', ' Demo3 ', ' Demo4 '), $page = intval ($_get[' page '); Gets the number of pages requested $start = $page *15; $query =mysqli_query ($link, "select * from say ORDER BY id DESC limit $start,");/* while ($row =mysqli_fetch_array ($query)) {  $arr [] = array (    ' content ' = $row [' content '],    ' author ' = = $user [$row [' UserID '],    ' Date ' =>date (' m-d h:i ', $row [' Addtime '])  ;} */if ($query) {while  ($row =mysqli_fetch_ Array ($query)) {    $arr [] = array (      ' content ' = + $row [' content '],      ' author ' = = $user [$row [' userid ']],      ' Date ' =>date (' m-d h:i ', $row [' Addtime '])    ;}  } if (!empty ($arr)) {  echo json_encode ($arr);//Convert to JSON data output}//echo Json_encode ($arr);//Convert to JSON data output?>

connect.php Database configuration file

<?php$host= "localhost"; $db _user= "root"; $db _pass= "admin"; $db _name= "Ajax_demo"; $timezone = "Asia/shanghai"; $ Link=mysqli_connect ($host, $db _user, $db _pass) mysqli_select_db ($link, $db _name); Mysqli_query ($link, "SET names UTF8 "); header (" content-type:text/html; Charset=utf-8 ");? >

Related recommendations:

PHP Array function knowledge Summary _php tips

PHP Object-oriented const constant modifier

PHP Random number C Extended random number

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.