zackcez Posted August 2, 2008 Share Posted August 2, 2008 Here's my code: foreach ($skillNames as $skill) { $q = "SELECT * FROM user ORDER BY ".$skill."xp DESC LIMIT 1"; $r = mysql_query($q) or die(mysql_error()); while($row = mysql_fetch_array($r)){ $perms = getPerms($row['usergroupid']); if ($perms == '1' || $perms == '0') { $pre = getPre($row['usergroupid']); $suf = getSuf($row['usergroupid']); $usernamer = $pre."".$row['username']."".$suf; echo"<tr><td class=\"alt1\" align=\"center\" nowrap=\"nowrap\">"; // "Layout" echo"<img src=\"http://rshelp.net/modules/highscores/icons/".$skill.".gif\"></td>"; //Image echo"<td class=\"alt1\" nowrap=\"nowrap\"><a href=\"index.php?pageid=highscores&action=user&user=" . $row['username'] . "\">$usernamer</a> (" . $row[''.$skill.'lvl'] . ")</td></tr>"; //User Info } } unset($q); unset($r); } Everything is correctly defined...lets say the person the query selects first doesn't have the right permissions, it then echo's nothing....how could i make it so if it returns without anything that it 'continues down the line' Link to comment https://forums.phpfreaks.com/topic/117799-foreach/ Share on other sites More sharing options...
cooldude832 Posted August 2, 2008 Share Posted August 2, 2008 can you clarify your statement? I think you are looking for a if(mysql_num_rows($r) >0) show results else report error sort of thing Link to comment https://forums.phpfreaks.com/topic/117799-foreach/#findComment-605891 Share on other sites More sharing options...
JasonLewis Posted August 2, 2008 Share Posted August 2, 2008 Wait, what do you mean 'continues down the line'? Link to comment https://forums.phpfreaks.com/topic/117799-foreach/#findComment-605896 Share on other sites More sharing options...
zackcez Posted August 2, 2008 Author Share Posted August 2, 2008 I only want this to display ONE column of data.... Link to comment https://forums.phpfreaks.com/topic/117799-foreach/#findComment-605898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.