I am trying to list the names of employees that do not have their profile pic. I use the following query to list all of the employees:
mysql_select_db($database_schedule, $schedule);
$query_Recordset7 = "SELECT DISTINCT schedule.ID, schedule.Name, schedule.Department
FROM schedule
ORDER BY schedule.Name";
$Recordset7 = mysql_query($query_Recordset7, $schedule) or die(mysql_error());
$row_Recordset7 = mysql_fetch_assoc($Recordset7);
$totalRows_Recordset7 = mysql_num_rows($Recordset7);
I want to now only list or echo employee names that do not have their profile pic in a folder labeled pics/. The profile pics are jpg's with the filename with the same name as their employee ID. e.g. ID-5530 would have a pic file labeled 5530.jpg. I tried using the following. It still echoes all the employee names (even the names with a matching pic file):
<?php
$ID = $row_Recordset7['ID'];
$image = 'pics/' . $ID . '.jpg';
if (!file_exists($image)) {
echo $row_Recordset7['Name'];
}else{
echo "";
}
?>