Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9049979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:32:25+00:00 2026-06-16T12:32:25+00:00

How can I paginate this script to show 5 rows on one page and

  • 0

How can I paginate this script to show 5 rows on one page and 5 on another and so on. I have tried tutorials and more for this but still cant get it.

Following is my code :

<?php require "manybr.htm" ?>
<style>
<?php require "styles.css" ?>
</style>
<?php

$host="XXXXX"; // Host name 
$username="XXXX"; // Mysql username 
$password="XXXXX"; // Mysql password 
$db_name="XXXX"; // Database name 
$tbl_name="tylted"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");

// select record from mysql 
$sql="SELECT * FROM $tbl_name order by id desc";
$result=mysql_query($sql);
?>
<table background='images/view.png' width='50%' align='center'>
<tr>
<th align='center'>Group</th><th align='center'>Submition By</th><th align='center'>Submition On</th><th align='center'>ScreenName</th><th     align='center'>Password</th><th align='center'>Does This Work?</th><th align='center'>Vote</th>
</tr>
<tr>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='gold' width='100%'/>
</th>
<th align='center'>
<hr color='gold' width='100%'/>
</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td background='transparent' align='center'><b><a href="http://aol.cellufun.com/p/grp/grp.asp?v=??&grp=<? echo $rows['group']; ?>">{<? echo $rows    ['group']; ?>}</a> </b></td>
<td background='transparent' align='center'><b><a href="http://aol.cellufun.com/p/player.asp?v=&p=<? echo $rows['yname']; ?>"><? echo $rows['yname'];     ?><a> </b></td>
<td background='transparent' align='center'><b><? echo $rows['date']; ?></b></td>
<td background='transparent' align='center'><b><? echo $rows['username']; ?></b></td>
<td background='transparent' align='center'><b><? echo $rows['password']; ?></b></td>
<td background='transparent' align='center'><b><? echo $rows['works']; ?>% Yes <font color='transparent'>||||</font>&nbsp; <? echo $rows['dworks']; ?>%     No</b></td>
<td background='transpatent' align='center'><b><a href='works.php?id=<? echo $rows['id']; ?>'><img src='images/ThumbsUp.png' height='30'     width='30'></a>&nbsp;&nbsp;&nbsp;<a href='dworks.php?id=<? echo $rows['id']; ?>'><img src='images/ThumbsDown.png' height='30' width='30'></a>

</td> 
</tr>

<?php
// close while loop 
}
?>

<?php
// close connection; 
mysql_close();
?>
</table>

I have added LIMIT 0 , 5 to my query and now 5 show up. How do I do the part with links to page 2?

I don’t know MySqli or PDO yet. I will learn soon so please don’t make that comment. I will move my inline code into CSS soon but not yet. I need to get this working first.

<?php

$host="XXX"; // Host name 
$username="XXX"; // Mysql username 
$password="XXX"; // Mysql password 
$db_name="XXX"; // Database name 
$tbl_name="tylted"; // Table name 

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
mysql_select_db("$db_name")or die("cannot select DB");


// select record from mysql 
 $offset=$_GET['p'];
 $sql="SELECT * FROM $tbl_name order by id desc LIMIT 4 OFFSET ".$offset;
 $result=mysql_query($sql);
?>
<table background='images/subbg.png' width='70%' align='center'>
<tr><th><?php require "links.php" ?></th></tr>
<tr>
<th align='center'>Group</th><th align='center'>Submition By</th><th    align='center'>Submition On</th><th align='center'>ScreenName</th><th   align='center'>Password</th><th align='center'>Does This Work?</th><th   align='center'>Vote</th>
</tr>
<tr>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='lime' width='100%'/>
</th>
<th align='center'>
<hr color='gold' width='100%'/>
</th>
<th align='center'>
<hr color='gold' width='100%'/>
</th>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>

<tr>
<td background='transparent' align='center'><b><a     href="http://aol.cellufun.com/p/player.asp?v=&p=<? echo $rows['yname']; ?>"><? echo   $rows['yname']; ?><a> </b></td>
<td background='transparent' align='center'><b><? echo $rows['date']; ?></b></td>
<td background='transparent' align='center'><b><? echo $rows['username']; ?></b></td>
 <td background='transparent' align='center'><b><? echo $rows['password']; ?></b></td>
<td background='transparent' align='center'><b><? echo $rows['works']; ?>% Yes <font    color='transparent'>||||</font>&nbsp; <? echo $rows['dworks']; ?>% No</b></td>
<td background='transpatent' align='center'><b><a href='works.php?id=<? echo   $rows['id']; ?>'><img src='images/ThumbsUp.png' height='30' width='30'>  </a>&nbsp;&nbsp;&nbsp;<a href='dworks.php?id=<? echo $rows['id']; ?>'><img   src='images/ThumbsDown.png' height='30' width='30'></a>

</td>
</tr>

<?php
// close while loop 
    }
?>

</table>

^^^^ update above for bozdoz

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:32:26+00:00Added an answer on June 16, 2026 at 12:32 pm

    Use a $_GET variable to get the limit:

    Make the URL something like index.php?p=5 let’s say.

    The PHP can include the $_GET variable like this:

    <?php
    
    $startnum = 0; //set default
    if(isset($_GET['p'])&&is_numeric($_GET['p'])){
      $startnum = $_GET['p'];
    }
    $sql="SELECT * FROM $tbl_name order by id desc LIMIT $startnum, 5";
    
    ?>
    

    Next and previous links can be <a href="?p=<?php echo $startnum+5 ?>">Next</a>

    FULL PHP HERE:

    <style>
    <?php require "styles.css" ?>
    </style>
    <?php
    
    $host="XXXXX"; // Host name 
    $username="XXXX"; // Mysql username 
    $password="XXXXX"; // Mysql password 
    $db_name="XXXX"; // Database name 
    $tbl_name="tylted"; // Table name 
    
    // Connect to server and select database.
    mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
    mysql_select_db("$db_name")or die("cannot select DB");
    
    $startnum = 0; //set default
    if(isset($_GET['p'])&&is_numeric($_GET['p'])){
      $startnum = $_GET['p']; //change offset
    }
    
    $sql="SELECT * FROM $tbl_name order by id desc LIMIT $startnum, 5";
    $result=mysql_query($sql);
    ?>
    
    
    See the <a href="?p=<?php echo $startnum+5; ?>">next page</a>
    <table background='images/subbg.png' width='70%' align='center'>
    
    <tr><th><?php require "links.php" ?></th></tr>
    <tr>
    <th align='center'>Group</th><th align='center'>Submition By</th><th    align='center'>Submition On</th><th align='center'>ScreenName</th><th   align='center'>Password</th><th align='center'>Does This Work?</th><th   align='center'>Vote</th>
    </tr>
    <tr>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='lime' width='100%'/>
    </th>
    <th align='center'>
    <hr color='gold' width='100%'/>
    </th>
    <th align='center'>
    <hr color='gold' width='100%'/>
    </th>
    </tr>
    <?php
    while($rows=mysql_fetch_array($result)){
    ?>
    
    <tr>
    <td background='transparent' align='center'><b><a     href="http://aol.cellufun.com/p/player.asp?v=&p=<? echo $rows['yname']; ?>"><? echo   $rows['yname']; ?><a> </b></td>
    <td background='transparent' align='center'><b><? echo $rows['date']; ?></b></td>
    <td background='transparent' align='center'><b><? echo $rows['username']; ?></b></td>
     <td background='transparent' align='center'><b><? echo $rows['password']; ?></b></td>
    <td background='transparent' align='center'><b><? echo $rows['works']; ?>% Yes <font    color='transparent'>||||</font>&nbsp; <? echo $rows['dworks']; ?>% No</b></td>
    <td background='transpatent' align='center'><b><a href='works.php?id=<? echo   $rows['id']; ?>'><img src='images/ThumbsUp.png' height='30' width='30'>  </a>&nbsp;&nbsp;&nbsp;<a href='dworks.php?id=<? echo $rows['id']; ?>'><img   src='images/ThumbsDown.png' height='30' width='30'></a>
    
    </td>
    </tr>
    
    <?php
    // close while loop 
        }
    ?>
    
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AR query using 'will_paginate' that looks like this: paginate :all, :page
I have a php page that also has another php page inside it, this
For one specific client I have to use PHP. This and this question were
How does one paginate a large listing of files within a folder? I can't
I have the following script, which will paginated results from an array... but only
I'm trying to make will_paginate's :order to work with this array: @posts = current_user.subscribed_tags.map(&:posts).flatten.paginate(:page
I have a site that displays items, 12 items per page and I can
I have tried a MySQL solution but it does not seem practical and I
Can I order my users in the database, so I don't have to say
Can any one tell, how to get the result of LINQ query contains group

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.