我正在查询我的数据库,如下所示:
<?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);
}
?>
如何在报告中的0和1位置显示P?
答案 0 :(得分:3)
将您的代码修改为:
(mysqli_num_rows($present_stu_res) > 0) ? "P" : "A";