PHP 中的数据网格

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16418873/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 11:05:05  来源:igfitidea点击:

Data Grid in PHP

phpgridviewdatagrid

提问by user2310840

I need to create a datagrid in a web application using php as the backend programming language, which will be populated from a MySQL database objects (views, stored procedures). The end user should be able to edit the data in this datagrid and the data in MySQL tables will need to get updated.

我需要使用 php 作为后端编程语言在 Web 应用程序中创建一个数据网格,它将从 MySQL 数据库对象(视图、存储过程)填充。最终用户应该能够编辑此数据网格中的数据,并且需要更新 MySQL 表中的数据。

If you can give me some examples -tutrial, demos, project with explanation on how to use those with examples, it will be a great help.

如果你能给我一些例子——tutrial、demo、project 以及如何使用这些例子的解释,那将是一个很大的帮助。

回答by Robert

You can use http://phpgrid.com

您可以使用http://phpgrid.com

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

// change column titles
$dg->set_col_title("orderNumber", "Order No.");
$dg->set_col_title("orderDate", "Order Date");
$dg->set_col_title("shippedDate", "Shipped Date");
$dg->set_col_title("customerNumber", "Customer No.");

// hide a column
$dg -> set_col_hidden("requiredDate");

// change default caption
$dg -> set_caption("Orders List");

$dg -> display();

examples can be found on http://phpgrid.com/example/

示例可以在http://phpgrid.com/example/上找到

it's easy to use and looks pretty.

它易于使用且看起来很漂亮。

data grid example

数据网格示例

回答by KSchoniov

Do you need to edit the data or just display only? If just display, you should take at look at the local array data source example.

你需要编辑数据还是只显示?如果只是显示,你应该看看本地数组数据源示例。

1.Return array from MySQL stored procedure, see this example: http://php.net/manual/en/mysqli.quickstart.stored-procedures.php,

1.从MySQL存储过程返回数组,看这个例子:http://php.net/manual/en/mysqli.quickstart.stored-procedures.php ,

2.Then use the phpGrid local array feature to display datagrid http://phpgrid.com/example/local_array_data_source/

2.然后使用phpGrid本地数组功能显示datagrid http://phpgrid.com/example/local_array_data_source/

That's it!

就是这样!

回答by devXen

Second phpGrid from http://phpgrid.com. I work for local school district. Trust me, we got a lot database tables to manage spread across multiple systems. phpGrid by far the best tool I've used to quickly develop web based content administration system.

来自http://phpgrid.com 的第二个 phpGrid 。我在当地学区工作。相信我,我们有很多数据库表来管理跨多个系统的分布。phpGrid 是迄今为止我用来快速开发基于 Web 的内容管理系统的最佳工具。