Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

guestbook help........

Status
Not open for further replies.

aldumil

Programmer
Sep 3, 2001
40
JP
I just leanred PHP about 3 weeks ago and really have two questions.....I am trying to make a guestbook based on a .txt file, how do I get it so that I can limit the number of posts per page and make links to the other pages? and my second question is....does anyone have any ideas/tips on how to make a function which tests the extesnion name of a file? I made something that kinda works using an array but it doens't cut it any and all help is appreciated thanks all
 
oh-yah and the file extension testing function is needed to test *.mp3 files...don't know if that would change anything
 
thanks I made a nifty little function that tests for the file extension and if it isn't *.mp3 it does not show it. I could still use some help on the guestbook problem though
 
Well, You could read and parse the entire file each time, that would tell you how many entries you have and ergo how many pages of ten there are to be displayed. Then only display those that are in the range you want to display...

IF( $REC_NUM >= $MinRec && REC_NUM <= MaxRec )
display_record() ;

or you could maintain a second file that just contains three fields, REC_NUM, STARTING_BYTE_POSITION, and ENDING_BYTE_POSTION, that way you can just read the index file each time and start reading the guestbook file at the appropriate point

hope it helps B-)
 
thanks for the help pepole what I did was...., set up a little counter type deal in the text file to that when the counter reaches 10 a script makes a new txt file and then the rest was easy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top