Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Harish Chauhan  >  Paging Easy  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example File
Class: Paging Easy
Generate links to navigate on query result pages
Author: By
Last change: Example File
Date: 9 years ago
Size: 1,436 bytes
 

Contents

Class file image Download
<?php

    
include_once("page.inc.php");

    
$con=mysql_connect('localhost','root','') or die('could not open mySql Connection!');

    
mysql_select_db("mydb") or die('Unable to open database');

    
$sql="SELECT username FROM member";

    
$result=@mysql_query($sql);

    
$total_records=@mysql_num_rows($result);
    
$record_per_page=3;
    
$scroll=4;

    
$page=new Page(); ///creating new instance of Class Page
    
    
$page->set_page_data($_SERVER['PHP_SELF'],$total_records,$record_per_page,$scroll,true,true,true);

    
/* if there is any query string you want to pass with links just use*/
  
    // $page->set_qry_string(name=harish&id=7347);

    // If you want to pass any parameters to page links such that stylesheet or style sheet class

    // $page->set_link_parameter("Class = myStyleSheetClass") OR
    // $page->set_link_parameter("Style='color:#FF0000;'")

    
$result=@mysql_query($page->get_limit_query($sql));
    
    while(
$row=mysql_fetch_array($result))
    {
        echo 
"User : ".$row['username']."<br>";
    }
    
    echo 
$page->get_page_nav();

    
/*
      if you want to use images as next previous etc. links then use like
      $page->get_first_page_nav("<img src='imgSource' alt='first'>");
      $page->get_prev_page_nav("<img src='imgSource' alt='next'>");
      $page->get_number_page_nav();
      $page->get_next_page_nav("<img src='imgSource' alt='prev'>");
      $page->get_last_page_nav("<img src='imgSource' alt='Last'>");

    */

?>