There are many articles introducing page turning in mysq, but there are very few introductions to page turning in text data table format. Here I will briefly talk about page turning
Mainly introduce the following page turning ideas
1. Page turning of the guestbook
2. Page turning of the text forum
————————————————————————
Guestbook Page turning:
——————————————————————————————
This page turning in the text data table is The simplest page turning, please explain like this
golbal file
Data.dat --- NOTE FILE USE
user.dat --- Forum File use
Data.dat
_________________________________________________________________________
[1] [POSTUSER] [TITLE] [MEM] [POSTTIME] [IP]
[2] [POSTUSER] [TITLE] [MEM] [POSTTIME] [IP]
[3] [ POSTUSER] [TITLE] [MEM] [POSTTIME] [IP]
[4] [POSTUSER] [TITLE] [MEM] [POSTTIME] [IP]
[5] [POSTUSER] [TITLE] [MEM] [POSTTIME] [IP]
Note:
The [1,2,3,4,5....] were added by myself, mainly for everyone’s better understanding
index.php source:.
____________________________________________
---====BOF====---
$file = "data.dat"; "data file
if(file_exits($file)){ 🎜> fclose($fp);
unset($fp);
}
$listnumber = 20; //Number of items displayed per page
$fp = file ($file); // Read data into the content
$number ){
print "No records yet, please leave a message";
/*+-------------------------------- ---+
|Print the FORM form here or connect to the form |
| URL, |
|
+------------------- -------------+*/
}else{
if(empty($_POST["page"])){ //This paragraph IF...ELSE.. .It was written to be compatible with the default settings of php4.20 and prevent invalid global variables.
🎜> }else{
$page = $_POST["page"]
}
if($page<0 || $page>pagenumber){ //Error detection processing, when the page parameter jumps out of the total page or is less than the home page (0), it will return to the first page
$page=0;
}
$startnote = $page*$listnumber; //Start recording position
$endnote =$startnote+$listnumber; //End recording position
//for($int_a=$startnote;$int_a<$endnote;$int_a++){ //The sorting display is similar to ASC mode
pirnt "