KeywordsPHP Chinese Text data page (Message book page)
MYSQ in the introduction of a lot of pages in the page, and Text data table-style page to introduce a few, here I simply say the page
Mainly introduce the following page thinking
1, the page of the message book
2, the Text forum page
————————————————————————
Page of the message book:
——————————————————————————————
This page in the Text data table is the simplest page to turn, which illustrates
---====bof====---
$file = "Data.dat"; Data files
if (File_exits ($file)) {//fault tolerant processing to prevent the existence of no data files
$FP =fopen ($file, "w+");
Fclose ($FP);
Unset ($FP);
}
$listnumber = 20; Show number of bars per page
$fp = file ($file); Read the data into the content
= count ($fp); Calculate Total data Volume
$pagenumber = Floor (/$listnumber) +1;
if (<1) {
PRint "Temporarily no record, welcome message";
/*+--------------------------------+
| print form form here or connect to table but |
| URL, |
+--------------------------------+*/
}else{
if (Empty ($_post["page"])) {//This paragraph if ... ELSE ... is intended to be compatible with the default settings of php4.20, which prevents invalid global variables from being written
$page = 0; Because it is read from the data text, stored in the array, there is an O subscript
}else{
$page = $_post["page"]
}
if ($page <0 | | $page >pagenumber) {//error-checking processing, when the page parameter jumps out of the total page or is less than the first page (0), it will return to the
$page = 0;
}
$startnote = $page * $listnumber; Start record location
$endnote = $startnote + $listnumber; End Record Location
For ($int _a= $startnote; $int _a< $endnote; $int _a++) {//Sort display similar to ASC mode
Pirnt "
"For ($int _a= $endnote; $int _a>= $startnote; $int _a--) {//Sort display similar to desc mode $info =explode (" \ t ", $fp [$int-a]); Cutting data to get detailed data for each record I'm using a TAB key to split the print "
$prevpage = $page-1; Page number of previous pages $nextpage = $page +1; Page number on Next
Print "
Home Previous page Next page Last
"; Here you can directly add the detection of the page here, so that others see is comfortable, but the effect is the same
For example, there may be 20 pages appearing on the next page or
}
?>
---====eof====---
Written in haste, and in the middle there are many because of the use of PHP4.20 so change a bit, such as Php_self has adopted _server["php_self"] and so on
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.