little thing about guestbooks - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

little thing about guestbooks

FirestormFirestorm Posts: 162Member
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?
[email protected]


  • JonathanJonathan Posts: 2,914Member

    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'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,


    Count downloads from your site for free!

Sign In or Register to comment.