如何从MySQL创建HTML表? [英] How to create HTML tables from MySQL?

查看:131
本文介绍了如何从MySQL创建HTML表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建系统的一部分,用户可以在其中定义mysql数据库中的视图".

I'm building a part of a system where the user can define "views" from a mysql database.

我想要一些从数据生成简单的HTML表/报告的方法,但不仅仅是SQL查询的简单输出-简单的联接可能还不够.

I want some way of generating simple HTML tables/reports from the data, but not just plain output of sql queries- simple joins probably isn't enough.

有什么想法吗?

要明确:我非常清楚如何使用PHP/MySQL创建HTML表-这是简单的部分.我想做的是允许我的用户创建自己的表,而无需进行任何处理!

Just to be clear: I know perfectly well how to create a HTML table with PHP/MySQL - that is the simple part. What I want to do is allow my USERS to create their own tables without being exposed to the process!

好的,我会提供更多详细信息-感谢所有答复:

当前,用户可以使用向导创建表,然后查看/编辑/删除这些表中的记录.由于表可能会更改,因此很难给出示例.我希望客户输入的数据用于出租房屋,包括房屋,租户,房间,维护问题等表格.

Currently users can create tables using a wizard, then view/edit/delete records in these tables. This makes it difficult to give an example as tables could change. The data I expect the client to input is for renting houses- a table of houses, tenants, rooms, maintenance issues etc.

我旨在使用户能够执行的操作是创建特定视图的一些基本格式输出,例如显示所有房屋本月的租金营业额"或显示逾期的租户"或不显示房间"租户".设置完成后,将只能查看这些内容,而不进行编辑,因此该过程只需要易于设置即可.

What I aim to enable the user to do is to create some basic formatted output of a particular view, for example "show rent turnover in the current month for all houses" or "show overdue tenants" or "show rooms with no tenants". Once set up, these will only be viewed, not edited, so the process just has to be bearable to set up.

这有意义吗?如果不可能,我将对视图进行硬编码-只会使系统的灵活性降低!

Does that make sense? If it's not possible I'll just hard-code the views- just makes the system less flexible!

推荐答案

您必须定义用户创建这些HTML表的方式.他们是否设置了许多行和列,然后手动输入表格?

You have to define the way users will create those HTML tables. Do they setup a number of rows and columns, then feed the table manually ?

一旦我们不得不做一个模板系统,其中所有图像,css属性,各种html块的位置等.整个系统只有5个或6个mysql表,只是为了存储模板属性,但是如果只是一个表,则可以简化过程.

Once we had to do a templating system where all images, css properties, positionning of various html blocks, etc. The whole system was 5 or 6 mysql tables just to store the templates properties, but if it's just a table you can ease the process.

想象一个mysql表,用于表的格式和属性(行数,列数,列宽,颜色等),以及另一个mysql表,用于放置数据.第二个表应具有用于存储日期,行和列位置的列.

Imagine one mysql table for table format and properties (row count, col count, col width, colors, etc.) and another mysql table for data to put inside. This second table should have columns for storing date, row and col positions.

剩下的就是让非技术用户可以访问表单,以配置和提供表格,并通过一些PHP循环和查询来呈现表格.

The rest is all making a form accessible to non-tech users to configure and feed table, and render table with some PHP loops and queries.

这篇关于如何从MySQL创建HTML表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆