Ajax pagination php ajax pagination java ajax pagination asp.net ajax pagination jquery ajax pagination jsp ajax refreshing pagination asp ajax pagination implementation pagination ajax jsp pagination
The result. php file is the most ,:
<? Php
// A series of queries made from the database will not be mentioned here... you can refer to the following for your reference.
// PHP server
/*
PHP paging Functions
Function Ajaxpage ($ SQL, $ num ){
Global $ db;
$ Pageno = $ _ GET ['pageno'];
$ Pageno = (int) $ pageno;
If (empty ($ pageno) | $ pageno <1) $ pageno = 1;
$ Result = $ db-> query ($ SQL );
$ Number = $ db-> num_rows ($ result );
$ Totalpage = (int) ceil ($ number/$ num );
If ($ pageno >=$ totalpage) {$ pageno = $ totalpage ;}
$ Start_rowno = ($ pageno-1) * $ num;
$ Query = $ SQL. "LIMIT". $ start_rowno. ",". $ num;
$ Result = $ db-> query ($ query );
Return array ('result' => $ result, 'page' => array ('pageno' => $ pageno, 'totalpage' => $ totalpage, 'number' => $ number ));
}
$ SQL = "select * from guest"; // query SQL statements
$ Num = 2; // control by page. Two records are displayed on each page.
$ Return = Ajaxpage ($ SQL, $ num );
While ($ row = $ db-> fetch_assoc ($ return ['result']) {
$ Result [] = $ row; // you can use PHP to process data here.
}
$ Result = array ('result' => $ result, 'page' => $ return ['page']);
Include ('json. class. php'); // contains json files
$ Json = & new Json ();
$ Result = $ json-> encode ($ result); // JSON
Echo $ result;
*/
// Assume that the resource obtained from the database through the pageno parameter sent by AJAX is in the format of $ str after JSON, and the output is directly processed by JS.
// If you have any questions, ask me.
If (ob_get_length () ob_clean ();
Header ('cache-control: no-cache, must-revalidate ');
Header ('pragma: no-cache ');
If ($ _ GET ['pageno'] = 1)
$ Str = '{"result": [{"id": "99", "name": "technology", "qq": "", "tel ": "", "email": "", "content": "[emot: 0]", "time": "1198522490", "ip": "127.0.0.1 ",
"Rcontent": null, "rtime": "0", "url": "0", "img": "app/index/image/show/1.gif "}, {"id": "100", "name": "test", "qq": "", "tel": "", "email ":"", "content": "[emot: 9]", "time": 1198548687 "," ip ":" 127.0.0.1 ","
Rcontent ": null," rtime ":" 0 "," url ":" 0 "," img ":" app/index/image/show/4.gif"}], "page": {"pageno": 1, "totalpage": 2, "number": 2 }}';
Else
$ Str = '{"result": [{"id": "101", "name": "Ah", "qq": "", "tel ": "", "email": "", "content": "[emot: 8] [emot: 1]", "time": "1198548716", "ip ": "127.0.0.1", "rcontent": null, "rtime": "0", "url": "0", "img ":
"App/index/image/show/9.gif"}]," page ": {" pageno ": 2," totalpage ": 2," number ": 3 }}';
Echo iconv ('gb2312', 'utf-8', $ str );
?>