CGI Development

Moderators: Jonathan
Number of threads: 55
Number of posts: 121

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
little thing about guestbooks Posted by Firestorm on 31 Mar 2002 at 10:35 AM
hi,
I've made a guestbook on my own and it works (strange, isn't it?)
but now when I want to see who signed it, I see the first to the last entry, BUT
I'd like to see the latest entry first and the first entry at the last point(because that is the oldest).

Could you give a hint how to do that?
thanks
Firestorm
blue_surfer2000@yahoo.de

Report
Re: little thing about guestbooks Posted by Jonathan on 1 Apr 2002 at 6:03 AM
Hi,

You could read every post in the guestbook into an array, then loop backwards from the end of the array to the start of the array. Like this:

for ($post=($numposts-1); $post>=0; $post--) {
#Display the post...it'll be in @postsarray[$post]
}

Hope this is clear. You need to increment $numposts every time you read another entry in. We do ($numposts-1) as an array has its first element as 0.

Take care,

Jonathan

------------------------------------------
Count downloads from your site for free!
http://www.downloadcounter.com/




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.