<?
//include sql2table class
include('sql2table.class.php');
//the query string you want to show
$query="Select * From employees";
//setup parameters for initiating Sql2Table instance
//modify your mysql connection parameters & database name
$db_host="localhost";
$db_user="";
$db_pwd="";
$db_dbname="xcompany";
//create a new instance of Sql2Table class
$obj=new Sql2Table($db_host,$db_user,$db_pwd,$db_dbname);
//setup the page display limit
$limit=10;
//initiate $offset variable is necessary
if(!isset($offset)){
$offset=0;
}
//SqlStart() is the main class method to do the trick
$obj->SqlStart($query,$offset,$limit);
//Show information
//GetNav() method would return navigation bar string
echo"<h1>".$obj->GetNav()."</h1><br>";
//GetPages() method would return display pages string
echo"<h1>".$obj->GetPages()."</h1><br>";
//GetGrids() method would return the content of Sql into HTML table format
echo $obj->GetGrids()."<br>";
//ShowTable() method would return a string combine Pages,Navigation&Sql Content
//in HTML table format. Easy for debugging!!
echo $obj->ShowTable();
?> |