Phpajax paging 4 _ PHP Tutorial

Source: Internet
Author: User
Page 4 of phpajax. Ajax pagination phpaajax pagination javaajax pagination asp. netaajax pagination jqueryajax pagination jspajax no-refreshing pagination aspaajax pagination problem ajax implementation pagination ajaxjsp pagination is the most p ajax pagination php ajax pagination java ajax pagination asp.net ajax pagination jquery ajax pagination jsp ajax No-refreshing pagination asp ajax pagination ajax implement pagination ajax jsp pagination
The result. php file is the most ,:

// 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 );
?>


Php ajax pagination java ajax pagination asp.net ajax pagination jquery ajax pagination jsp ajax without refreshing pagination asp ajax pagination problem ajax implementation pagination ajax jsp pagination is the most p...

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.