#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    Looking for some information on how I might code next and previous links. Have a number of titles pulled from a database and would like to give users the ability to go through each title one by one. At the moment, I have next 10 and previous 10 working. How would I go from one to the next one.
    Anybody???

    ------------------
    Rosie
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Rosie,

    i have given an example for same topic at:
    http://www.devshed.com/Talk/Forums/F...ML/000234.html


    see that and edit as per your requirment..




    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    Thanks Shiju. I had already found that script before I posted my query but hadn't had a chance to try it out. I'll do that this morning and let you know how I get on.



    ------------------
    Rosie
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Shiju Rajan:
    Rosie,

    i have given an example for same topic at:
    http://www.devshed.com/Talk/Forums/F...ML/000234.html


    see that and edit as per your requirment..



    [/quote]

  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    Shiju,
    I can see how that code works but can't quite figure out how to adapt to my needs. Not been programming very long!!
    I have approx 2000 records in a database which a user can select to view in blocks of 5 or 10 then view next 5 or 10 and so on. I need a link at the top of the record allowing them to move on to the next one record and not the next 5 or 10. I can see how you are deciding how many pages require a link but I seem to be bringing up a few hundred with a link to the next few hundred at the bottom.
    What am I doing wrong or not seeing??? Think its too late on a Friday afternoon to think too deeply!!

    ------------------
    Rosie
  10. #6
  11. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    Rose ,

    i'll help you to sort it out your problem..


    <<
    I need a link at the top of the record allowing them to move on to the next one record and not the next 5 or 10.

    this i'm not clear.....


    but I seem to be bringing up a few hundred with a link to the next few hundred at the bottom.


    ok..but it may take sometimes to populate on the screen...

    Can you tell me the details ,how you want to display the records? or you may post your code ,i'll edit it and give back to you..

    Tell me which database you are using for saving records?..

    If you are using mysql ,then your job is very easy especially becoz you can use LIMIT clause in the select statement....






    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  12. #7
  13. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)
    i m also closely watching whts going on here.
    b'cos im doing this project now ..
    I modified something in The Program given by Shiju and it is working well and fine.

    vijay
  14. #8
  15. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    Hi Shiju.
    Here is exactly what should happen. On the first search form, a user enters a date and a few other relevant details. Clicks the search button. The mysql database is searched and brings out a list or records according to the date the user entered. These records at that point are displayed in a table by the title of the record only as a hyperlink. The user clicks on the title he wants to view and the whole record is displayed on the next page. At the top of that page are links for next and previous searches. The next search takes the user back to the original search form to allow him to carry out the search again. The previous search takes him back to the form with the previous search terms already entered allowing him to amend one or more of them. And the other link is for next and previous blocks. ie, if he clicks Next he can view the next 5 block of records. If he clicks previous, he can view the previous 5. However, I also want to include another next link which will allow the user to move on to the next record and then the next, one at a time. So if he is currently viewing record number 1250, he can click next and move on to 1251 or back to 1249. Does this all make sense?
    You've been a great help so far and I really appreciate. I sit here on a Saturday morning when I would much rather be home relaxing!!
    Thanks again.

    ------------------
    Rosie
  16. #9
  17. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    yea Rose!!,

    I understand what you are explaining above.It can be done..Explainig the logic will take few minutes.Now i am involved in some urgent Java projects.

    Tommorow(Sunday) after charch i'll get some free time,then i'll explain you the complete logic how you can implement this very easily..


    <<
    I sit here on a Saturday morning when I would much rather be home relaxing!!
    >>

    Saturday must be a holiday for you.But you know,we'll have to work 6 days here in India.Sunday will go with full time church activities...so no free time at all..


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

    [This message has been edited by Shiju Rajan (edited July 08, 2000).]
  18. #10
  19. No Profile Picture
    chinnavi
    Guest
    Devshed Newbie (0 - 499 posts)

    Your Requirement is simple and easily can done .
    this is the program logic you have to do ...

    1.Have you designed the HTML form?
    2.Write the CGI to take all the parameters..
    3.This will the program flow..

    #!usr/bin/perl
    use CGI;
    use DBI;

    $q = new CGI ;
    $dsn = "dbi:mysql:database";
    $user = "name";
    $pwd = "password";

    # Get all the values from the form ..
    $day = $query->param('day');

    #connect to the DB

    my $dbh = DBI->connect($dsn,$usr,$pwd) &#0124; &#0124; die "Connecting Error!";
    my $sql = qq { select * from database where constraints };
    my $sth1 = $dbh->prepare( $sql );
    my $numrows = $sth1->execute;

    # Now $sth1 will contain the results ..
    # Process the Results
    while ($sth1->fetchrow_array)
    {
    #print the results here
    }

    ------

    this is the simple program that will do the interface ...
    Do practice this then practice the program in
    previous one ...given by shiju.

    all the best

    vijay


  20. #11
  21. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    6
    Rep Power
    0
    Thanks Vijay. However, that part of the program is already working!



    ------------------
    Rosie
  22. #12
  23. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
    Rosie,


    <<However, that part of the program is already working!>>

    Then where you are stucking up?

    ---


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."

IMN logo majestic logo threadwatch logo seochat tools logo