i’m using JSON to get data and then PHP to display. so…
i’m showing everything available to a person and i want to echo a message when the loop is blank/empty that “there’s nothing available” because right now it just shows a blank screen when there is no data… any ideas??
<?
foreach($json['available'] as $r) {
echo '<li><a href="url.php?id='.$r['id'].'">' .$r['item'].'</a></li>';
}}
?>
Just use an
ifstatement and check if$json['available']is empty withempty().