views:

714

answers:

8

Hi I'm fairly new to PHP and was wondering if there is an equivalent in PHP of an ASP.NET Listview or Gridview with paging and easy formatting?

A: 

If you are interested in jquery/ajax solution they you can try out his one. http://www.datatables.net/examples/

zapping
+3  A: 

http://www.phpgrid.com/grid/

Example 1: A Basic PHP Datagrid

The basic PHP datagrid requires only as little as five lines of code. Foremostly, always create phpGrid object in the first line; then call its functional methods to define sql SELECT string, sql table name, sql primary key, and relative path to phpGrid; finally, always call display() to render output to screen.

$dg = new C_DataGrid($hostName, $userName, $password, $dbName);

$dg -> set_gridpath     ("include/");
$dg -> set_sql          ("SELECT * FROM Employees");
$dg -> set_sql_table    ("Employees");
$dg -> set_sql_key      ("EmployeeId");
$dg -> display();
Haim Evgi
The above example is outdated. Here's the latest update of the same phpgrid example. http://phpgrid.com/example/example-1-a-basic-php-datagrid-2/
Chenster
A: 

There is this (somewhat outdated) PEAR package Structures_DataGrid

This package provides a toolkit to generate data tables in HTML, CSV, Excel, XML, Smarty, and other formats. It retrieves data from a variety of data sources, including SQL, CSV, XML, PDO, DB_DataObject, DB_Table, and others. It can transparently page and sort the data, through optimized database queries, by parsing/generating GET, POST requests and REST-like urls. It is designed with modularity and extensibility in mind, using drivers for all rendering and datasource formats.

Gordon
A: 

There's not any intrinsic support, but lots of 3rd party tools, e.g. phpLens, dhtmlxgrid, and lots of jquery based solutions (http://php-team.blogspot.com/2009/05/10-jquery-datagrid-plugins.html)

C.

symcbean
A: 

you should consider jquery ones.. here is a nice one i've used before... jqGrid http://www.trirand.com/blog/

Yash
A: 

I dont believe that PHP comes with an ASP GridView like control. The best I have done in the past is utilize a combination of jQuery, CSS, and HTML to generate a GridView-like layout.

Nertim
A: 

I'll second Yash. I use jqGrid for all my datagrid needs. Doesn't matter what server technology you use.

Gregg
+1  A: 

Referring to my comments, the above example is outdated. Here's the latest update of the same phpgrid example.

//parameter 1: SQL statement
//parameter 2: SQL primary key
//parameter 3: SQl table name

$dg = new C_DataGrid("SELECT * FROM orders", "orderNumber", "orders");
$dg -> display();

More info: http://phpgrid.com/example/example-1-a-basic-php-datagrid-2/

Demo: http://phpgrid.com/grid/examples/phpGridx/examples//basic_phpgrid.php?iframe=true&width=850&height=500

Chenster