PHP Classes

File: simple2.txt

Recommend this page to a friend!
  Classes of Shiegege   Paging for MySQL   simple2.txt   Download  
File: simple2.txt
Role: Example script
Content type: text/plain
Description: Simple Search
Class: Paging for MySQL
Create a query results page navigation bar
Author: By
Last change: Add url
Date: 20 years ago
Size: 635 bytes
 

Contents

Class file image Download
<?
// see online: http://kentung.f2o.org/scripts/paging/sample2.php

include("./form.html"); // include form.html

require("paging_class.php");

$paging=new paging(5,5);
$paging->db("localhost","username","password","dbname");

$paging->query("select * from paging where MY_FIELD like '%$_GET[keyword]%' order by MY_FIELD asc");

echo
"<center>".$paging->print_link()."</center><hr>";


$page=$paging->print_info();
    echo
"Data $page[start] - $page[end] of $page[total]<br>\nSearch: $_GET[keyword]<hr>\n";

while (
$result=$paging->result()) {
    echo
$paging->print_no()." : ";
    echo
"$result->MY_FIELD<br>\n";
}
?>