关于使用Php和Mysql的表的数组元素,我有关于此的问题,所以目标是按日期显示的子标题。理论上显示了两个表格数组。你能救我吗?
图片示例:
我将代码PHP与Mysql粘贴。
echo "<table class='tbmapa' width='300px' align='center'>";
echo "<col width='30%'><col width='60%'>";
$query = "SELECT fecdate FROM incidents";
$result = $conn->query($query);
while($row = $result->fetch_assoc()){
echo "<thead><tr>";
echo "<th>DAY N° 01</th>";
echo "<th id='data'>".$row['fecdate']."</th>";
echo "</thead></tr>";
echo "</table>";
$i=0;
$conn->next_result();
$query2 = "SELECT secc, time, desc, obs FROM incidents WHERE fecdate = '$_GET['data']'";
echo "<table class='tbmapa' width='300px' align='center'>";
echo "<col width='10%'><col width='10%'><col width='40%'><col width='30%'><col width='5%'><col width='5%'>";
echo "<thead>";
echo "<tr>";
echo "<th>SEC</th>";
echo "<th>TIME</th>";
echo "<th>DESCRIPTION</th>";
echo "<th>OBS</th>";
echo "<th>EDIT</th>";
echo "<th>SEND</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$result1 = $conn->query($query2);
while($rowdb = $result1->fetch_assoc()){
echo "<tr>";
echo "<td>".$rowdb['secc']."</td>";
echo "<td>".$rowdb['time']."</td>";
echo "<td>".$rowdb['desc']."</td>";
echo "<td>".$rowdb['obs']."</td>";
echo "<td>EDIT</td>";
echo "<td>SEND</td>";
echo "</tr>";
$i++;
}
echo "</tbody>";
echo "</table>";
$x++;
}
$result->close();
感谢