A database table named users has a column timemarks.
The timemark fields look like this.. 11:00:00, 13:45:00, 17:00:00, 18:25:00 (time-marks vary for each user)
My php script should list the users who have a specified time-mark.
Query: SELECT * FROM ('users') (query result is returned to $users)
Loop:
- iterate through users
- create array
$timemarks_arrfor each user by splitting timemarks string usingstr_getcsv- echo users with specified time-mark value
foreach ($users as $user):
$timemarks_arr = str_getcsv($user->timemarks); //split time-marks by comma and create array
if (in_array("17:00:00", $timemarks_arr)) //users with specified time-mark
{
echo $entry->username . "<br />";
}
endforeach;
For some reason it echos only 2 users but there are more with time-mark 17:00:00. Does anyone have any idea why?