PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Fahad Waheed Khan   MSSQL Pagination   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script file
Class: MSSQL Pagination
Split MS SQL query results in multiple pages
Author: By
Last change:
Date: 16 years ago
Size: 859 bytes
 

Contents

Class file image Download
<?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
?>