How to display only 5 records per page from my mysql database table through pagination?

后端 未结 6 733
北恋
北恋 2021-01-06 11:51

I want to display five record per page through pagination (mysql,php,html,css) until all the records are displayed, navigation to pages must be like,

6条回答
  •  攒了一身酷
    2021-01-06 12:47

    i Give you an example of my project of pagination. Just you have to put your values in the code
    
    $sql="SELECT * FROM tblname  LIMIT  $next,5";
    $results = mysqli_query($conn,$sql);
        }
            else if (isset($_POST['prev']))
            {
                $prev1=$_POST['prev'];
                $next=$_POST['prev'];
                $prev=$prev1;
                $sql="SELECT * FROM tablename  LIMIT  $prev,5";
                $prev=$prev1;
                $results = mysqli_query($conn,"SELECT * FROM tablename LIMIT  $prev,10");   
                    if($prev==0)
                    {
                        $prev = 0;
                    }
                    else
                    {
                        $prev=$next-10;   
                    }
            }
            else
            {
                $next=0;
                $prev=0;
                $results = mysqli_query($conn,"SELECT * FROM tablename LIMIT  $next,10");
            }
    

提交回复
热议问题