PHP Classes
elePHPant
Icontem

Data Grid Component: Display MySQL query results in HTML tables

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2008-02-07 (8 years ago) RSS 2.0 feedNot enough user ratingsTotal: 1,552 All time: 2,457 This week: 987Up
Version License PHP version Categories
data_grid 1.0GNU General Publi...5.0HTML, PHP 5, Databases
Description Author

This package can be used to display MySQL query results in HTML tables.

It takes a MySQL query result handle and generates an HTML table showing data returned by the query. The query field names are displayed in the table headers.

If there too many result rows, the class can also limit the number of result records that are displayed per page. In that case, the class also displays links to go to pages that display other ranges of the query result.

The table width and height, the cell and navigation link styles are configurable.

Picture of haseeb
Name: haseeb <contact>
Classes: 1 package by
Country: India India

Details
About Datagrid Component
------------------------------

Introduction
-------------
This datagrid component will make life easier for a php programmer by means of generating datagrid on the fly by supplying a few inputs to the datagrid method like width, height, no of records per page, etc


System Requirements
-------------------------
1. Php > 5
2. Mysql
3. Apache 2.0
4. OS - Any


Methods
----------
In this component the main class is "datagrid.inc.php" which has the following methods listed below:

       1.DataGrid($w,$h,$lmt,$qResult,$class,$thClass,$linkClass) // Class Constructor
       2.DisplayGrid()
       3.GridData($result,$rec_limit)


1. DataGrid($w,$h,$lmt,$qResult,$class,$thClass,$linkClass) // Class Constructor
----------------------------------------------------------------------------------------
This method is the Datagrid class constructor which consists of the following parameters which has to be initialised during class object initialisation.
               
                   1.$w - Grid Width
                   2.$h  - Grid height
                   3.$lmt - Specifies how many records per page
                   4.$qResult - This is the mysql query result which has to be passed
                   5.$class    - This parameter takes the class name for the grid
                   6.$thClass - This parameter takes the class name for the grid heading row
                   7.$linkClass - This paramter takes the class name for the navigation links (eg: next, back)
 
2.DisplayGrid()
----------------
This method will invoke the  GridData($result,$rec_limit) method.

3.GridData($result,$rec_limit)
----------------------------------
This is the method which most of the grid display functionality. It takes two parameters one the query result and other the limit ie records per page.


Note
------

DBClient.php
--------------
                   DBClient.php class is the one which takes care of the db connection and query execution so this class has to be added. 
This class can be used individually for interacting with mysql database. This class supports php version greater than 5


Example:
----------
              datagrid.php can be taken as the example for this class. 
  Files folder image Files  
File Role Description
Plain text file datagrid.inc.php Class datagrid class
Accessible without login Plain text file datagrid.php Example datagrid example
Plain text file DBClient.php Class Database Class
Plain text file MYSQLClient.inc Class Database Class Interface
Accessible without login Plain text file Readme Doc. Class Documentation

 Version Control Unique User Downloads Download Rankings  
 0%
Total:1,552
This week:0
All time:2,457
This week:987Up