I want it so that if there are players in the array, it will return with the pictures. That works so far. What doesn’t work is that when no players are in the array, it will return a blank picture and will not echo "No Players Online".
$query = (Minequery::query("67.202.102.224"));
$plist = $query['playerList'];
foreach($plist as $k => $v)
// print_r(Minequery::query_json("67.202.102.224"));
if (defined($plist)){
echo'<img src="http://minotar.net/avatar/'.$v.'" title="'.$v.'" height="50" width="50"> ';
} else {
echo 'No Players Online';
}
You kinda have your cart in front of your horse:
You’re checking to see if the array has content AFTER you’ve started trying to iterate through it. Try this: