I am populating rows inside a table from Mysql, I have an echo <td>
inside a table, what I've been trying to accomplish is inside the while mysql_fetch_array, to echo " Absent" IF the query didn't return any records for that specific html table row, I tried using the mysql_num_rows==0, but it doesn't work as there are rows that DO exist in the query and thus using this approach will not work.
$sqlsun = "SELECT * FROM cscc_attendance WHERE cscc_attendance.empId= '$row[empId]' AND cscc_attendance.login_datetime>'".$this_start1->format('Y-m-d 00:00:00')."' AND cscc_attendance.login_datetime<'".$this_start1->format('Y-m-d 23:59:59')."' GROUP BY cscc_attendance.empId";
$sqlsunexe = mysql_query($sqlsun);
echo "<td style=\"background-color:#e6e6e6\"><b>";
while($rowdate1 = mysql_fetch_array($sqlsunexe))
{
if (empty($rowdate1["login_datetime"]))
{
//IF NO MYSQL RESULT, ECHO TO ROW TD:
echo "ABSENT";
}
else
{
//THERE IS A QUERY RESULT, FILL THE TD IN TABLE:
$newhour = new DateTime($rowdate1["ready_time"]);
$newhourmodstr = $newhour->modify('-1 hour');
echo $newhourmodstr->format('H:i:s');
}
}
echo "</b></td>";"