clanstyles Posted July 7, 2007 Share Posted July 7, 2007 function checkRank($reqRank) { $id = $_SESSION['id']; $result = mysql_query("SELECT * FROM `acc_ranks` WHERE `userid`=$id"); $rankList = Array(); while($res = mysql_fetch_array($result)) { $rankList = $res['rankid']; } foreach($rankList as $value) { if($value == $reqRank) { return true; } } return false; } Whats wrong w/ that? Warning: Invalid argument supplied for foreach() in /xxxxxxxxxxxxxxxxxxxxxxxxxxx on line 41 Quote Link to comment https://forums.phpfreaks.com/topic/58800-solved-foreach-error/ Share on other sites More sharing options...
pocobueno1388 Posted July 7, 2007 Share Posted July 7, 2007 Try changing this line: $rankList = $res['rankid']; To: $rankList[] = $res['rankid']; Quote Link to comment https://forums.phpfreaks.com/topic/58800-solved-foreach-error/#findComment-291750 Share on other sites More sharing options...
clanstyles Posted July 7, 2007 Author Share Posted July 7, 2007 thx im spacing out tonight can't figureout why/ Probally cuz im hungery. Quote Link to comment https://forums.phpfreaks.com/topic/58800-solved-foreach-error/#findComment-291752 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.