Location: PHPKode > scripts > Paging Easy > paging-easy/example.php
<?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'>");

	*/

?>
Return current item: Paging Easy