PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of Erh-Wen,Kuo   sql2table   example.php   Download  
File: example.php
Role: ???
Content type: text/plain
Description: Example file to demostrate how to use sql2table class
Class: sql2table
Easy way to display Mysql sql content.
Author: By
Last change:
Date: 22 years ago
Size: 1,179 bytes
 

Contents

Class file image Download
<? //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(); ?>