SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Jan 2011
    Location
    Noida
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to create paging in PHP (page no)

    how to create paging when fetch data from mysql database

    PHP Code:

    $sql 
    "select * from product";
    $rs  mysql_query($sql) or die("database error");

    $i=1;
    while(
    $re  mysql_fetch_array($rs))
    {
    S.No : echo $i."<br>";
    Product Name : echo $re['item'];
    Product Description : echo $re['desc'];
    $i++;

    I want display only 10 product on one page if product more than 10 then print on second page.

    plz help me................

  2. #2
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    This is a fairly frequently aired subject on this forum, so my best advice is to search this forum for the terms paging and/or pagination.

    Or even google pagination tutorial php.

  3. #3
    SitePoint Member
    Join Date
    Jan 2011
    Location
    Noida
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yaa I tried but not found any correct script which are working so I just ask in this forum

  4. #4
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Well, seeing as you have read those tutorials and discounted them, you must at least now know how to use mysql LIMIT clause to fetch blocks of say, 10 rows from your database.

    So where are you up to? What problem have you hit?

  5. #5
    SitePoint Wizard bronze trophy Immerse's Avatar
    Join Date
    Mar 2006
    Location
    Netherlands
    Posts
    1,661
    Mentioned
    7 Post(s)
    Tagged
    1 Thread(s)
    They're not working? Maybe you didn't implement them correctly?

    Try to implement one of the solutions already posted in these forums (there's about 3000), and if you have trouble, show us your code.


Tags for this Thread

Bookmarks

Posting Permissions

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