I have a donor list on database which all have some point data. User can select few donors to show their point table on frontend by their id. A function is for getting user point info as array from database. I have generated tab for each donor. And the first tab will be active by default.
<?php
foreach ($userGivenDonorID as $donor){
$data = Libary::get_point($donor);
if($donor=== reset($userGivenDonorID )){
echo '<li class="tablink active">'.$donor['name'].'</li>';
} else {
echo '<li class="tablink">'.$donor['name'].'</li>';
}
}
?>
Now the problem is I want to skip a donor id if it's not having any point data on database thus giving an empty array for Libary::get_point($donor)
. Cause if for any reason I don't have any data for the first user given id I don't get the first tab active by default.