Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to put P in the place of 1 and A in the place of 0

I'm quering my database as below:

<?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);
}
?>

How can I display P in the place of 1 and A in the place of 0 in my report?

like image 856
Raj Avatar asked Oct 19 '22 08:10

Raj


1 Answers

Modify your code as :

(mysqli_num_rows($present_stu_res) > 0) ? "P" : "A";
like image 69
Sha Avatar answered Nov 01 '22 14:11

Sha