PHP Classes

File: formRead.php

Recommend this page to a friend!
  Classes of Umesh Rai   MySQL Paginator   formRead.php   Download  
File: formRead.php
Role: Example script
Content type: text/plain
Description: Reads from the form
Class: MySQL Paginator
Display MySQL query results split in pages
Author: By
Last change:
Date: 18 years ago
Size: 1,006 bytes
 

Contents

Class file image Download
<?php
/**
 * this is an example which splits the query results into multiple totalpages as search engine does
 * you can change the query and format in which the result is being printed
 */
session_start();
$page = $_REQUEST['page'];
if (
$_REQUEST['sql'])$_SESSION['sql'] = $_REQUEST['sql'];
if (
$_REQUEST['line'])$_SESSION['line'] = $_REQUEST['line'];
if (
$_REQUEST['fieldRequire'])
   
$_SESSION['fieldRequire'] = true;
else
   
$_SESSION['fieldRequire'] = false;
$sql = $_SESSION['sql'];
include(
"database/DbData.php");
if (!
$_SESSION['line'])
   
$line = 10;
else
   
$line = $_SESSION['line'];
echo
"<b>Page No: " . $page . "</b>";
if (!
$sql) {
   
$sql = $conn->sql;
}

$connDB = $conn->connect($sql, $line); //create an object of split pass the sql and total no of rows to be displayed in a page
if ($conn->errMsg != "") {
    die(
$conn->errMsg);
}
$rows = $conn->getQuery($page);
$conn->showTable($rows, $_SESSION['fieldRequire']);
$conn->pageFooter($page);

?>