正确的语法在<td>中使用条件检查? [关闭]

This code works fine but i dont want show btnvalue which is zero and one istead of that i want show Log-In Log-out with checking btnvalue which is zero and one. Help me with the correct syntax of checking value or if/else condtion inside td tag.

 <?php  

 if(isset($_POST["from_date"] , $_POST["to_date"]))  
 {

  $connect = mysqli_connect("localhost", "root", "root", "attendance");  
  $output = '';  
  $query ="SELECT * FROM logintime WHERE date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."'  UNION SELECT * FROM logouttime WHERE date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."'
    ";
  $result = mysqli_query($connect, $query);  
  $output .= '  
       <table class="table table-bordered">  
            <tr>  
                <th>EMP-ID</th>
                <th>STATUS</th>
                <th>TIME</th>
                <th>DATE</th>
                <th>DAILY JOB</th>
            </tr> 
  ';


  if(mysqli_num_rows($result)>0)
  {
       while($row = mysqli_fetch_assoc($result))  
       {  
            $output .= '  
                 <tr>  
                      <td>'. $row["techid"] .'</td>  
                      <td>'. $row["btnvalue"].'</td>  
                      <td>'. $row["time"] .'</td>  
                      <td>'. $row["date"] .'</td>  
                      <td>'. $row["comment"] .'</td>  
                 </tr>  
            ';  
       }  
    }
  else  
  {  
       $output .= '  
            <tr>  
                 <td colspan="5">No Attendance Found</td>  
            </tr>  
       ';  
  }  
  $output .= '</table>';  
  echo $output;  
 }
 ?>

The following will show Log-in or Log-out based on btnvalue:

<?php  

 if(isset($_POST["from_date"] , $_POST["to_date"]))  
 {

  $connect = mysqli_connect("localhost", "root", "root", "attendance");  
  $output = '';  
  $query ="SELECT * FROM logintime WHERE date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."'  UNION SELECT * FROM logouttime WHERE date BETWEEN '".$_POST["from_date"]."' AND '".$_POST["to_date"]."'
    ";
  $result = mysqli_query($connect, $query);  
  $output .= '  
       <table class="table table-bordered">  
            <tr>  
                <th>EMP-ID</th>
                <th>STATUS</th>
                <th>TIME</th>
                <th>DATE</th>
                <th>DAILY JOB</th>
            </tr> 
  ';


  if(mysqli_num_rows($result)>0)
  {
       while($row = mysqli_fetch_assoc($result))  
       {  
            $output .= '  
                 <tr>  
                      <td>'. $row["techid"] .'</td>  
                      <td>'.(($row["btnvalue"]=='0') ? 'Log-in':'Log-out').'</td>  
                      <td>'. $row["time"] .'</td>  
                      <td>'. $row["date"] .'</td>  
                      <td>'. $row["comment"] .'</td>  
                 </tr>  
            ';  
       }  
    }
  else  
  {  
       $output .= '  
            <tr>  
                 <td colspan="5">No Attendance Found</td>  
            </tr>  
       ';  
  }  
  $output .= '</table>';  
  echo $output;  
 }
 ?>

Try like below set of code in your while loop:

$output .= '  
     <tr>  
          <td>'. $row["techid"] .'</td>  
          <td><input type="checkbox" value="'.$row["btnvalue"].'" '.($row["btnvalue"] == 1)? 'checked' : '' .' >'.($row["btnvalue"] == 1)? 'Logged In' : 'Logged Out' .'</td>  
          <td>'. $row["time"] .'</td>  
          <td>'. $row["date"] .'</td>  
          <td>'. $row["comment"] .'</td>  
     </tr>  
'; 

If $row["btnvalue"] is 1: then its show checked, else unchecked.

In my code i have considered 1 as Logged In & 0 as Out