Jump to content

Recommended Posts

Hi...

 

I need a condition in my webpage that if the LOGIN fields is NULL.

That row will be highlighted in RED.

 

i try this code but it did not work...

$LOGIN = $DTR->fields['LOGIN'];
if($LOGIN == NULL){
"<td style='background-color:RED'>";
//echo '<style = background-color: RED;>'.$DTR.'</style>';
} 

I have this code:

<?php

include 'config.php';

$currentEmpID = $_SESSION['empID']; 

if(!isset($_POST['Regsubmit_'])){ 
     
    $DATE1 = $_GET['Regfirstinput'];
    $DATE2   = $_GET['Regsecondinput'];


$sql = "SELECT a.EMP_NO, CONCAT(LNAME, ', ' , FNAME, ' ', MI) AS FULLNAME, a.LOGIN, a.LOGOUT
FROM $ATTENDANCE.employee_attendance AS a LEFT JOIN $ADODB_DB.employment em ON a.EMP_NO = em.EMP_NO 
LEFT JOIN $ADODB_DB.personal p ON em.EMP_ID = p.EMP_ID WHERE DATE(LOGIN) BETWEEN '$DATE1' AND '$DATE2' 
AND em.STATUS IN ('Reg Operatives', 'Reg Staff ') OR LOGIN IS NULL";  

    $DTR = $conn3->GetAll($sql);
    
$LOGIN = $DTR->fields['LOGIN'];

if($LOGIN == NULL){
"<td style='background-color:RED'>";
//echo '<style = background-color: RED;>'.$DTR.'</style>';
}   
$smarty->assign('attendance', $DTR);

}
$smarty->display('header_att.tpl');
$smarty->display('RegAttendance.tpl');
$smarty->display('footer.tpl');
  
?> 

 

<div id="attendance" style="width: 580px; height: 420px; overflow: auto; padding: 5px; top:95px">
<fieldset>
<legend>Employee Attendance</legend>
<table border="1">
<tr>
<td colspan="2" style="text-align:center">Employee No</td>
<td colspan="2" style="text-align:center">Employee Name</td>
<td colspan="2" style="text-align:center">Time In</td>
<td colspan="2" style="text-align:center">Time Out</td>
</tr>

{section name=att loop=$attendance}
  <tr>
    <td colspan="2">{$attendance[att].EMP_NO}</td>
    <td colspan="2">{$attendance[att].FULLNAME}</td>  
    <td colspan="2">{$attendance[att].LOGIN|date_format:"%d-%m-%Y %I:%M %p"}</td>
    <td colspan="2">{$attendance[att].LOGOUT|date_format:"%d-%m-%Y %I:%M %p"}</td> 
  </tr>
{sectionelse}
  <tr><td colspan="1">No DATA</td></tr>
{/section}
</table>
</fieldset>
</div>

 

Thank you

Link to comment
https://forums.phpfreaks.com/topic/253732-need-help-in-highlighting-null-values/
Share on other sites

How can I check it if my template is like this:

 

<div id="attendance" style="width: 580px; height: 420px; overflow: auto; padding: 5px; top:95px">
<fieldset>
<legend>Employee Attendance</legend>
<table border="1">
<tr>
<td colspan="2" style="text-align:center">Employee No</td>
<td colspan="2" style="text-align:center">Employee Name</td>
<td colspan="2" style="text-align:center">Time In</td>
<td colspan="2" style="text-align:center">Time Out</td>
</tr>

{section name=att loop=$attendance}
  <tr>
    <td colspan="2">{$attendance[att].EMP_NO}</td>
    <td colspan="2">{$attendance[att].FULLNAME}</td>  
    <!--<td colspan="2">{$attendance[att].TimeIn}</td> -->
    <td colspan="2">{$attendance[att].LOGIN|date_format:"%d-%m-%Y %I:%M %p"}</td>
    <td colspan="2">{$attendance[att].LOGOUT|date_format:"%d-%m-%Y %I:%M %p"}</td> 
    <!--<td colspan="2">{$attendance[att].TimeOut|date_format:"%d-%m-%Y %I:%M %p"}</td>-->
   <!-- <td colspan="2">{$attendance[att].TimeOut}</td>  -->
  </tr>
{sectionelse}
  <tr><td colspan="1">No DATA</td></tr>
{/section}
</table>
</fieldset>
</div>

 

Thank you

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.