fife Posted March 24, 2011 Share Posted March 24, 2011 Im trying to echo certain code if the array returned is empty. I know for certain the array is empty and it works when its not empty. here is my code <?php while ($club = mysql_fetch_assoc($qclubs)) { if (empty($club)) {echo "<option value='None'>None</option>";} else{ echo" <option value='{$club['groupID']}'>{$club['group']}</option>"; }}?> Can someone please point out the error of my ways? Link to comment https://forums.phpfreaks.com/topic/231603-empty-arrays/ Share on other sites More sharing options...
silkfire Posted March 24, 2011 Share Posted March 24, 2011 Try to echo the contents out normally but with like 'x' on both sides. Maybe it's a string with multiple tabs, spaces. echo 'x', $club, 'x'; Tell me what you get on those you think are empty. Link to comment https://forums.phpfreaks.com/topic/231603-empty-arrays/#findComment-1191766 Share on other sites More sharing options...
AbraCadaver Posted March 24, 2011 Share Posted March 24, 2011 print_r($club); Link to comment https://forums.phpfreaks.com/topic/231603-empty-arrays/#findComment-1191859 Share on other sites More sharing options...
kenrbnsn Posted March 24, 2011 Share Posted March 24, 2011 That "while" statement will never return an empty row. Ken Link to comment https://forums.phpfreaks.com/topic/231603-empty-arrays/#findComment-1191895 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.