Page through a text file line by line
I have a text file formatted like;
I will do a search that may return multiple matches.
$data = "$username | $realname | $phone | $email\r\n";
How can I display a single line of the text file in a Web form and then click next to go to the next line of the file.
If you prefer to do it on the server side, then I'd probably use a typical pagination approach where each request sets an offset counter on the "next" link to indicate how many lines to skip. Then either use fgets() or such in a loop to skip that many lines and then read the new line, or just dump the file into an array with file() and then grab that numbered array element.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Originally Posted by NogDog
On the server, I can get it to read the first line. Can you provide some sample code to get the other lines 1 @ a time. eg.. a functioning next button .
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)