我想在<td>
标签中显示区域,然后在其他<td>
标签中显示数组中所有日期的剩余计数
该区域应显示所有区域,另一列应显示日期
<?php
$conn = mysqli_connect("localhost", "root", "", "zzz");
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// Connection Checked
//query
$alldata = "SELECT Region,COUNTRY,PoP_Cat,IPPoPStatus FROM finaltable";
$result = $conn->query($alldata);
//for region
$dateasdf = array("Nov-13","Mar-14","Dec-15","Nov-17","Apr-18","Feb-19","Apr-19");
$dateasdfqw = array("Nov13","Mar14","Dec15","Nov17","Apr18","Feb19","Apr19");
for ($x=0;$x<7;$x++) {
${"region" . $dateasdfqw[$x]} = "SELECT Region,count(Region) FROM finaltable WHERE Date='$dateasdf[$x]' GROUP BY Region";
${"region" . $dateasdfqw[$x]} = $conn->query( ${"region" . $dateasdfqw[$x]});
${"row" . $dateasdfqw[$x]} = ${"region" . $dateasdfqw[$x]}->fetch_assoc();
}
//Interpreting _loop
//$regionNov13="SELECT Region,count(Region) FROM finaltable WHERE Date='Nov13' GROUP BY Region";
//$regionNov13=$conn->query($regionNov13);
//$row=$regionNov13->fetch_assoc();
echo'<div id="showOne"><table style="width:80%" id="customers" align="center">';
//for region
if ($result->num_rows > 0) {
// output data of each row
do
{
//echo '<pre>' , var_dump($region) , '</pre>';
echo "<tr><td>". $rowApr19["Region"]."</td><td>". $rowNov13["count(Region)"]."</td><td>".$rowMar14["count(Region)"]."</td></tr>";
}
while(($rowApr19 = $regionApr19->fetch_assoc())&&($rowNov13 = $regionNov13->fetch_assoc())&&($rowMar14 = $regionMar14->fetch_assoc()));
echo "</table>";
}
echo'</div>';
?>