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

    Join Date
    Aug 2000
    Location
    Nutley,NJ,USA
    Posts
    7
    Rep Power
    0
    Hi All;
    I have php/mysql code that fetches info from a mysql table.
    I need to implement code that shows only 10 at a time with "Next10" and "Prev10" buttons.
    I'm not sure how to implement the php3 part of it. Those buttons would call the same php3 module?
    If you can help me with general idea of how to do this, I would appreciate it.

    Thanks,
    AK.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    51
    Rep Power
    14
    check out www.phpbuilder.com. there is a reallly good article regarding this exact subject.

    /wj
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Nutley,NJ,USA
    Posts
    7
    Rep Power
    0
    Thanks for the help, but...
    Couldn't find it on the site? Can you tell me more about where did you find the Article?

    Thanks,
    AK
  6. #4
  7. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    click on the following link.
    http://www.phpbuilder.com/columns/rod20000221.php3

    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


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

    Join Date
    Jul 2000
    Location
    England, UK
    Posts
    83
    Rep Power
    14
    I'm using the script from phpbuilder.com but I can't work out how to display the results, can anyone help?
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Niteroi, RJ, Brazil
    Posts
    30
    Rep Power
    14
    I also want to implement it and I have a few ideas...

    Try this:

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    if (!$page) {
    SELECT ... LIMIT 1, 10
    }
    else {
    $temp = ($page*10);
    SELECT ... LIMIT $temp, 10
    }
    [/code]

    This gets 10 results. Then (or before everything) you should get total records so you display the links with the $PHP_SELF?page=1, $PHP_SELF?page=2, ...

    Next will be $page++ and Prev $page-- if $page < $total_rows and $page > 1

    coding this is a little bit harder and since I didn't implemented it yet I dunno exactly how to do it...

    Good work!

    ------------------
    Eduardo Teixeira Cardoso
    PHP Programmer from Brazil
    idnotfound@vircio.com.br

    [This message has been edited by IdNotFound (edited August 19, 2000).]
  12. #7
  13. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    <<
    I'm using the script from phpbuilder.com but I can't work out how to display the results, can anyone help?
    >>

    Hi girish,
    if you can give us an idea where you are stucking up in that script then probably we can help you to solve your problem.


    <<
    coding this is a little bit harder and since I didn't implemented it yet I dunno exactly how to do it...
    >>


    i think that script which Mr.Rod has written is very easy to understand.And alot of people are using that logic.try to modify that script as per your requirment.

    ------------------
    SR -
    webshiju.com
    www.jobxyz.com-IT Career Portal
    ezipindia.com--WebStudio


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

    [This message has been edited by Shiju Rajan (edited August 20, 2000).]
  14. #8
  15. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    My apologies to all. That script was NOT meant to be production quality but an EXAMPLE for others to learn the logic of setting up that kind of functionality. I didn't make that clear in the article. I wrote it in a hurry on a Sunday morning when I should still have been sleeping, as a result of several posts here and on phpbuilder.com about how to implement prev/next functionality. Perhaps the time has come to rewrite the article....
  16. #9
  17. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Nutley,NJ,USA
    Posts
    7
    Rep Power
    0
    Got it to work, and I thank you for it.

    One question though:

    I have the sql_connect in the same php3 file. Do I get a new connection everytime the php is called (In other words do i get multiple connections open?)

    Thanks.
  18. #10
  19. No Profile Picture
    Apprentice Deity
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Jul 1999
    Location
    Niagara Falls (On the wrong side of the gorge)
    Posts
    3,237
    Rep Power
    18
    No. If you used mysql_connect() (or mysql_pconnect() with PHP compiled stand alone) the connection will close when the script ends (the php interpreter process ceases -- nothing to maintain the connection).

    If you have PHP compiled as a module and use mysql_pconnect() then the connection will remain open, but subsequent calls to mysql_pconnect() will use the already open connection. Eventually the connection will be terminated but that's nothing you need to worry about.

Similar Threads

  1. Apache2 w/ php4 as DSO.. but I need to revert to php3
    By JunkCookie in forum PHP Development
    Replies: 0
    Last Post: August 11th, 2003, 02:05 PM
  2. cannot read php3 scripts
    By MKashlev in forum PHP Development
    Replies: 1
    Last Post: September 2nd, 2001, 10:48 PM
  3. PHP3 parsing in files with .HTM extension
    By Robert Trost in forum PHP Development
    Replies: 3
    Last Post: March 31st, 2001, 11:52 PM
  4. PHP3 -> PHP4 - how to reconfigure applications?
    By adam2000 in forum PHP Development
    Replies: 1
    Last Post: December 14th, 2000, 01:00 AM
  5. PHP3 and PHP4 together
    By an_easy_marc in forum PHP Development
    Replies: 1
    Last Post: October 20th, 2000, 04:44 AM

IMN logo majestic logo threadwatch logo seochat tools logo