我正在尝试使用php nd mysql将多维数组显示到html表中。
数组结构如下
Array
(
[az] => Array
(
[0] => Array
(
[work] => dsdsds
[time] => 2:47---2:55
[total] => 8
)
)
[an] => Array
(
[0] => Array
(
[work] => sdsdsdsdsd
[time] => 1:47---2:47
[total] => 60
)
)
[mu] => Array
(
[0] => Array
(
[work] => sdsdsd
[time] => 1:30---2:48
[total] => 78
)
)
[raj] => Array
(
[0] => Array
(
[work] => dsdwew
[time] => 3:34---3:40
[total] => 6
)
[1] => Array
(
[work] => cdsfdfdfd
[time] => 3:25---3:35
[total] => 10
)
)
)
它将首先遍历列,然后它将会出现像这样的行
user1 user2 user3
aa bb cc
Plz建议..
答案 0 :(得分:1)
答案 1 :(得分:0)
如果我理解你的问题,写下你需要的东西
foreach($array as $tr=>$trData)
{
echo "<tr>{$trData["which field you want to display"]}</tr>";
echo "<tr>";
foreach($tdData as $td=>$tdData)
{
echo "<td>{$tdData["which field you want to display"]}</td>";
}
echo "</tr>";
}