Location: PHPKode > scripts > MSSQL Pagination > mssql-pagination/example.php
<?php

include($_SERVER['DOCUMENT_ROOT']."/mssqlClass/mssql_pagina_class.php");

$test = new MssqlPagina;

$test->sql = "SELECT * FROM Territories"; // the (basic) sql statement (use the SQL whatever you like)

$result = $test->get_page_result(); // result set



// displaying records in a table
echo "<table border=1>";

foreach($result as $key=>$val){
echo "<tr>";
foreach($val as $key2=>$val2)
echo "<td>$val2</td>";
echo "</tr>";
}

echo "</table>";





echo "<br><br>";
echo "Total records returned = {$test->get_total_rows()} <br>";
echo "Total number of pages = {$test->get_num_pages()} <br>";
echo "You are viewing page number = ".($test->set_page()+1)." <br> <br>";


// Show navigation link
echo $test->show_navigation();

$test->free_page_result(); // if your result set is large then free the result here
?>
Return current item: MSSQL Pagination