About the paging code of text guestbook_PHP tutorial
//When writing a file, use "|||" to separate each record, and "||" to separate each field in the record
//For example, record one is represented as $str1= $name."||".$pass."||".$title."||".$message."||".…………
//Then use it when connecting record one and record two, $str=$str1."|||".$str2."|||.......
//The final generated file is as follows
//Flying Fox||450948643||This is the theme|| This is the message content||1|||Flying Fox||450948643||This is the topic||This is the message content||2|||Flying Fox||450948643||This is the topic||This is the message content|| 3|||Flying Fox||450948643||This is the topic||This is the message content||4|||Flying Fox||450948643||This is the topic||This is the message content||5|||Flying Fox ||450948643||This is the topic||This is the message content||6|||Flying Fox||450948643||This is the topic||This is the message content||7|||Flying Fox||450948643||This is the topic||This is the message content||8|||Flying Fox||450948643||This is the topic||This is the message content||9|||Flying Fox||450948643||This is the topic||This is Message content||10|||Flying Fox||450948643||This is the topic||This is the message content||11|||Flying Fox||450948643||This is the topic||This is the message content||12| ||Flying Fox||450948643||This is the topic||This is the message content||13|||Flying Fox||450948643||This is the topic||This is the message content||14|||Flying Fox|| 450948643||This is the topic||This is the message content||15|||Flying Fox||450948643||This is the topic||This is the message content||16|||Flying Fox||450948643||This is the topic ||This is the message content||17|||Flying Fox||450948643||This is the topic||This is the message content||18|||Flying Fox||450948643||This is the topic||This is the message content ||19|||Flying Fox||450948643||This is the topic||This is the message content||20|||Flying Fox||450948643||This is the topic||This is the message content||21||| Flying Fox||450948643||This is the topic||This is the message content||22|||Flying Fox||450948643||This is the topic||This is the message content||23|||
//Then Start fetching the data in the file, the program list is as follows
$end="|||"; //Record separator, depending on the symbol used when writing the file
$mid="||"; // Field delimiter, same as above
$temp=file("messageboard.info"); //Read the file content into the array
$temp=join("",$temp); //The array to be read Become a string
$mess=explode($end,$temp); //Split the record
$num=count($mess); //Calculate the number of split string array elements, which is the record Number
if (!$dpage) $dpage=1; //Storage the current page number
$row=15; //The number of rows you want to display on each page
if ($num/$row= = Floor ($ NUM/$ Row) $ page = $ num/$ row; // See if you can get an integer, you can take
Else if ($ num/$ row & gt; = Floor ($ num/$ $ ($ num/$ row)) $page=floor($num/$row)+1; //If the total number divided by the number of rows per page is greater than the number of requests, round it up and add one.
else if ($num/$row<=floor($num/$row)) $page=floor($num/$row); //If it is smaller than rounding, round it up
$minnum =($dpage-1)*$row; //The current page starts fetching records from this number
$maxnum=$row*$dpage; $minnum;$i<$maxnum;$i++)
{
$message=explode($mid,$mess[$i]); //Split out the fields in the record
$num1=count ($ Message); // Calculate the number of elements in the array to control the loop
for ($ j = 0; $ j & lt; $ num1; $ j ++)
{
echo $ message [$ j] ." "; //Display one element in the array at a time.
Two pages, and if you are currently on the first page
{ $paged=$dpage+1; echo "Previous pageNext page
"; }
else if ($page>=2&&$dpage>=$page) //If the total number of pages is greater than two pages , and the current page is less than the total number of pages
{ $pageu=$dpage-1; echo "Previous pageNext page
"; }
else if ($page>=2&&$dpage>=1&&$dpage<$page) // If the total number of pages is greater than two pages, and the current page is greater than one and less than the total number of pages
{ $pageu=$dpage-1;$paged=$dpage+1;echo "Previous page Previous page< br>";}
//If there is only one page
else echo "Previous pagePrevious page
";
?>
[The copyright of this article is jointly owned by the author and Aosuo.com. If you need to reprint, please indicate the author and source]
http://www.bkjia.com/PHPjc/316272.html
www.bkjia.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



Pinduoduo software provides a lot of good products, you can buy them anytime and anywhere, and the quality of each product is strictly controlled, every product is genuine, and there are many preferential shopping discounts, allowing everyone to shop online Simply can not stop. Enter your mobile phone number to log in online, add multiple delivery addresses and contact information online, and check the latest logistics trends at any time. Product sections of different categories are open, search and swipe up and down to purchase and place orders, and experience convenience without leaving home. With the online shopping service, you can also view all purchase records, including the goods you have purchased, and receive dozens of shopping red envelopes and coupons for free. Now the editor has provided Pinduoduo users with a detailed online way to view purchased product records. method. 1. Open your phone and click on the Pinduoduo icon.

When deleting or decompressing a folder on your computer, sometimes a prompt dialog box "Error 0x80004005: Unspecified Error" will pop up. How should you solve this situation? There are actually many reasons why the error code 0x80004005 is prompted, but most of them are caused by viruses. We can re-register the dll to solve the problem. Below, the editor will explain to you the experience of handling the 0x80004005 error code. Some users are prompted with error code 0X80004005 when using their computers. The 0x80004005 error is mainly caused by the computer not correctly registering certain dynamic link library files, or by a firewall that does not allow HTTPS connections between the computer and the Internet. So how about

Quark Netdisk and Baidu Netdisk are currently the most commonly used Netdisk software for storing files. If you want to save the files in Quark Netdisk to Baidu Netdisk, how do you do it? In this issue, the editor has compiled the tutorial steps for transferring files from Quark Network Disk computer to Baidu Network Disk. Let’s take a look at how to operate it. How to save Quark network disk files to Baidu network disk? To transfer files from Quark Network Disk to Baidu Network Disk, you first need to download the required files from Quark Network Disk, then select the target folder in the Baidu Network Disk client and open it. Then, drag and drop the files downloaded from Quark Cloud Disk into the folder opened by the Baidu Cloud Disk client, or use the upload function to add the files to Baidu Cloud Disk. Make sure to check whether the file was successfully transferred in Baidu Cloud Disk after the upload is completed. That's it

Recently, many netizens have asked the editor, what is the file hiberfil.sys? Can hiberfil.sys take up a lot of C drive space and be deleted? The editor can tell you that the hiberfil.sys file can be deleted. Let’s take a look at the details below. hiberfil.sys is a hidden file in the Windows system and also a system hibernation file. It is usually stored in the root directory of the C drive, and its size is equivalent to the size of the system's installed memory. This file is used when the computer is hibernated and contains the memory data of the current system so that it can be quickly restored to the previous state during recovery. Since its size is equal to the memory capacity, it may take up a larger amount of hard drive space. hiber

If you need to program any device remotely, this article will help you. We will share the top GE universal remote codes for programming any device. What is a GE remote control? GEUniversalRemote is a remote control that can be used to control multiple devices such as smart TVs, LG, Vizio, Sony, Blu-ray, DVD, DVR, Roku, AppleTV, streaming media players and more. GEUniversal remote controls come in various models with different features and functions. GEUniversalRemote can control up to four devices. Top Universal Remote Codes to Program on Any Device GE remotes come with a set of codes that allow them to work with different devices. you may

Detailed explanation of the role of .ibd files in MySQL and related precautions MySQL is a popular relational database management system, and the data in the database is stored in different files. Among them, the .ibd file is a data file in the InnoDB storage engine, used to store data and indexes in tables. This article will provide a detailed analysis of the role of the .ibd file in MySQL and provide relevant code examples to help readers better understand. 1. The role of .ibd files: storing data: .ibd files are InnoDB storage

As a programmer, I get excited about tools that simplify the coding experience. With the help of artificial intelligence tools, we can generate demo code and make necessary modifications as per the requirement. The newly introduced Copilot tool in Visual Studio Code allows us to create AI-generated code with natural language chat interactions. By explaining functionality, we can better understand the meaning of existing code. How to use Copilot to generate code? To get started, we first need to get the latest PowerPlatformTools extension. To achieve this, you need to go to the extension page, search for "PowerPlatformTool" and click the Install button

In Linux systems, you can use the following command to view the contents of the log file: tail command: The tail command is used to display the content at the end of the log file. It is a common command to view the latest log information. tail [option] [file name] Commonly used options include: -n: Specify the number of lines to be displayed, the default is 10 lines. -f: Monitor the file content in real time and automatically display the new content when the file is updated. Example: tail-n20logfile.txt#Display the last 20 lines of the logfile.txt file tail-flogfile.txt#Monitor the updated content of the logfile.txt file in real time head command: The head command is used to display the beginning of the log file
