# Paging Test!

**URL:** <https://forum.kirupa.com/t/paging-test/255836>\
**Category:** programming\
**Created:** [March 27, 2008, 1:41pm UTC](https://forum.kirupa.com/t/paging-test/255836 "2008-03-27T13:41:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![onmosh](https://avatars.discourse-cdn.com/v4/letter/o/958977/32.png) [@onmosh](https://forum.kirupa.com/u/onmosh)\
**Post date:** [March 27, 2008, 1:41pm UTC](https://forum.kirupa.com/t/paging-test/255836/1 "2008-03-27T13:41:09Z")

</div>

I cannot get the result for this one. But the ouput is like this:  
Name 01 02 03 04 05 06 07 08 09 10 [1 [URL=“http://localhost/tutornetz/pagination.php?page=2”]2](http://localhost/tutornetz/pagination.php?page=1)

any idea guys?

```php

<?
$connection = mysql_connect("localhost", "root", "test1") or die(mysql_error());
mysql_select_db("students1") or die(mysql_error());

if (isset($_GET[“page”])) { $page = $_GET[“page”]; } else { $page=1; };
$start_from = ($page-1) * 10;
$sql = "SELECT * FROM studs1 ORDER BY name1 ASC LIMIT $start_from, 10";
$rs_result = mysql_query ($sql,$connection);
?>
<table>
<tr><td>Name</td></tr>
<?
while ($row = mysql_fetch_array($rs_result)) {
?>
            <tr>
            <td><? echo $row[0]; ?></td>
            </tr>
<?
};
?>
</table>
<?
$sql = "SELECT name1 FROM studs1";
$rs_result = mysql_query($sql,$connection);
$row = mysql_fetch_row($rs_result);
while($row1 = mysql_fetch_array($rs_result))
    {
        $first = $row1[0];
    }

//echo $first;
$total_records = $row1[0];
$total_pages = ceil($first / 10);

for ($i=1; $i<=$total_pages; $i++) {
            echo "<a href='pagination.php?page=".$i."'>".$i."</a> ";
};
?>

```
