Pagination

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > PHP Programming

Pagination

jailbox
Can anyone help me with pagination of a txt file which looks something like this:

some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>
some message <br/>



The <br/> tag is the end of the message. Anyone?

Reply

Roly
pagination? what?

Reply

DMA
no idea

Reply

jailbox
Atleast the guys at devshed know what it is.
You know, in google, it divides the search results in multiple pages. I want it to do it with a txt file

Reply

X3r0X
Thats incorrect. It should be <BR> instead of </BR>. It seems like the person was trying to use another forum of HTML and trying to close the brackets tongue.gif

Reply

jailbox
QUOTE(Rival @ Nov 13 2004, 10:06 AM)
Thats incorrect. It should be <BR> instead of </BR>. It seems like the person was trying to use another forum of HTML and trying to close the brackets tongue.gif
*



I forgot to mention that its not html. Its wml. For wap. So <br/> is 100% correct

Reply

krap
He said <br/> not </br> anyway tongue.gif

Reply

Hamtaro
Even in regular HTML, <br/> is also correct. Many HTML tags that don't have a closing tag (like <img>) can also be used that way. Anyway, back on topic:
I'm sorry, but I have no idea how I could help you...sorry!

Reply

mizako
I suppose you want to provide pagination using PHP. I created a guestbook with pagination for one of my pages. Basically i have all my entries in a MySQL database and using php code i achieve pagination. Maybe if you do not want to use a database, you can modify the algorithmus a little bit to work with text files.
Here is my code:

CODE

<?php
   $sql_db     = "Db_Name";
   $sql_user   = "Db_User";
   $sql_pass   = "Db_Passwd";
   $sql_table  = "Db_Table";
   
   if(isset($pos)==0)
       $pos=0; // start position for the page indexer
   $count=3; // number of displayed items per page
   
   mysql_connect("localhost", $sql_user, $sql_pass);
   mysql_select_db($sql_db);
   $result = mysql_query("select MAX(id) from ".$sql_table.";");
   $data = mysql_fetch_assoc($result);
   $size = $data['MAX(id)'];
   $result = mysql_query("SELECT * FROM ".$sql_table." where id>".$pos.";");
   if($result)
   {
       $i=0;
       while(($data = mysql_fetch_assoc($result)) && ($i < $count))
       {
           // Here you should add text
           $i++;
       }
   }
   mysql_close();
   print "<div>Pages:";
   for($j=0; $j<$size; $j++)
       if(!($j % $count))
           print "<a href=\"book.php?pos=".$j."\">".(($j/$count)+1)."</a>\n";
   print "Total number of entries: ".$size."\n";
   if ($pos > 0)
       print "<a href=\"book.php?pos=".($pos-$count)."\">Back</a>\n";
   if($size > $pos+$count)
       print "<a href=\"book.php?pos=".($pos+$count)."\">Next</a>\n";
?>


Let me know if i can help you in oder way.

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.


*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for pagination

*MORE FROM TRAP17.COM*
advertisement



Pagination



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE