我正在查询我的数据库如下:
<?php
while($date <= $end) {
$ttl++;
$student_array = array();
$stu_name_td = '';
mysqli_data_seek($result,0);
while($innerrow = mysqli_fetch_array($result)) {
$atd_query = "SELECT * FROM attendance WHERE AttDate = '".date('Y-m-d', $date)."' AND sl_no = '".$innerrow['sl_no']."'";
$present_stu_res = mysqli_query($link, $atd_query);
$test = mysqli_num_rows($present_stu_res) > 0 ? 1 : 0;
}
echo "<th>".date('j/m/Y', $date)."</th>";
$date = strtotime("+1 day", $date);
}
?>
如何在报告中显示 P 代替 1 和 A 代替 0?
最佳答案
将您的代码修改为:
(mysqli_num_rows($present_stu_res) > 0) ? "P" : "A";
关于javascript - 如何把P放在1的位置,A放在0的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31131893/