我需要从此查询中获取矩阵形式的HTML表格:
SELECT category,
entrydate,
SUM(effortext+effortself)
FROM entries
WHERE YEAR(entrydate) = '2016'
GROUP BY category, month(entrydate)
ORDER BY category ASC
结果我得到了类似的东西:
category entrydate value
CAT1 2016-02-01 1051
CAT1 2016-03-01 903
CAT1 2016-04-01 869
CAT1 2016-05-02 546
CAT1 2016-06-01 486
CAT1 2016-07-01 530
CAT1 2016-08-01 604
CAT1 2016-09-01 639
CAT1 2016-10-04 879
CAT1 2016-11-01 1548
CAT1 2016-12-05 242
CAT2 2016-01-04 615
CAT2 2016-02-01 673
CAT2 2016-03-01 687
CAT2 2016-04-01 435
CAT2 2016-05-02 416
我需要使用php将这些数据显示为HTML表格,但我不知道如何开始。对于我的数据库连接和查询,我得到了程序mysqli。像mysqli_query()
category Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
CAT1 0 1051 903 869 546 ...
CAT2 ...
CAT3
...