谢谢朋友们的帮助和反馈。我知道我不擅长 PHP,但仍在尝试学习和使用它:D——我的表包含针对 evaid 作为 Open Close 或 In Process 的重复条目——使用下面的代码,我从 DB 中获得了每个条目的最后输入状态通过使用查询和 if 语句来显示数据的状态,但我也想获取它的计数。任何人都可以帮助我---例如---
$sql = "SELECT * FROM (SELECT * FROM disagreements ORDER BY addeddate DESC) disagreements GROUP BY evaid";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0) {
while($row = mysqli_fetch_assoc($result)) { // Here with this query I got last entered status of each row against evaid – as 2 Open – 5 in Process and 10 Closed --- with below if statement – I can echo the rows with status but I want to have count of it that how many are open, in process or closed
if($row["status"]=='Open') { // I want to count this value as 2
echo "<tr>";
echo "<td>" . $row["evaid"]. "</td>";
echo "<td>" . $row["status"]. "</td>";
echo "</tr>";
}
}
} else {
echo "Nothing to Display";
}
mysqli_close($conn);
Cats萌萌
阿晨1998