Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: Archived post

  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Archived post

    I have a page with post. I have it show the 5 newest post. I want to keep it like that but I also want users to see ther other post with out having to view a page with 86,047 post or having a really long nav. Please help.

    Thanks advanced,
    Metsuo

  • #2
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That only works for PHP5 I need this to work for PHP4

  • #4
    Regular Coder
    Join Date
    Aug 2004
    Location
    The US of A
    Posts
    767
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Pagination is software independent. PHP5, PHP4, ASP, Perl, C, Ruby, I bet Javascript can do it with some clever scripting.

  • #5
    Regular Coder
    Join Date
    Sep 2004
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Pagenation is ****ed up. All I want to do is archive my post.

  • #6
    Senior Coder missing-score's Avatar
    Join Date
    Jan 2003
    Location
    UK
    Posts
    2,194
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No need to get upset...

    What you are looking for im sure is pagination of some kind... If you just want to archive posts other than the first 5 then you can simply make another page that selects all but the first 5 results, and displays them... of course, there could be several results other than the first 5, so you would need to split them into pages hence pagination.

    The links shown on google there look all ok, none of them require PHP 5. (at least none that I found)... Pagination is not a PHP module or technology, its just a name given to the sequential numbering of pages. (This forum use pagination on the forum view and thread views).

    Take a better look at the google link provided for you there, its all in there!

  • #7
    Regular Coder
    Join Date
    Sep 2004
    Posts
    137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The only thing I found that I could use was this.

    PHP Code:
    <?php
    // Pagination script

    /* This simple script automates the creation of navigation links for the datas extracted from
        the database.Pls Feel free to modify it and mailme back.Thanx
        Author: Sam George; ocptime@rediffmail.com
        Licence: GPL.    
    */

    // No Files are included and stylesheets and other config files can be
    //    included according to your wish.
    //    Uses ADO_DB for database abstraction and no documentation as the script is fairly straight forward


    $sqlCount="SELECT  count(u.id) FROM msg_mail as m, user as u
                WHERE  m.userTo='$userId'
                AND m.status <> 'trash'"
    ;

    $rsCount $db->Execute($sqlCount);

    $totalrows $rsCount->fields[0];


    $limit=5;

    if(empty(
    $page)){
        
    $page 1;
    }

    $limitvalue = ($page 1) * $limit;
        
    $sql "SELECT m.mailId, m.userTo, m.userFrom, ".$db->substr."(m.subject,1,25) as subject, m.status,  u2.name, u.userName, m.date
            FROM msg_mail as m, user as u
            WHEREm.userTo='$userId'
            AND m.status <> 'trash'
            ORDER BY m.date DESC LIMIT $limitvalue, $limit"
    ;

    $rs $db->Execute($sql);

    if(
    $rs->RecordCount()>0){

        while(
    $row $rs->FetchRow()){
        
                
    $userTo=$row['userTo'];
                
    $userFrom=$row['name'];
                
    $mailId=$row['mailId'];
                
    $subject=$row['subject'];
                
    $message=$row['message'];

    //put uer <td> and <tr> here to fill the data
    }



    if(
    $page 1){
      
    $pageprev $page-1;
      echo(
    "<a href=\"mypage.php?page=$pageprev\">PREV</a>&nbsp;");
    }
                                                                
    $numofpages ceil($totalrows $limit);

    for(
    $i 1$i <= $numofpages$i++){
        if(
    $page == $i){
            echo(
    $i."&nbsp;");
        }else
            echo(
    "<a href=\"mypage.php?page=$i\">$i</a>&nbsp;");
    }

    if(
    $page $numofpages){
        
    $pagenext = ($page 1);
        echo (
    "<a href=\"mypage.php?page=$pagenext\">NEXT</a>");
    }

    ?>
    That gives me an idea of how to do my own.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •