zackcez Posted August 2, 2008 Share Posted August 2, 2008 Here's my code: $i = '0'; $q = mysql_query("SELECT * FROM user ORDER BY ".$skill."xp DESC"); $row = mysql_fetch_array($q); $e = getExclude($row['usergroupid']); do { if ($e == '1') { $i++; } else { $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 } } while ($i>0); //LINE 77 Everything is defined....it just sits for the max time and stops .... Fatal error: Maximum execution time of 30 seconds exceeded in myfile.php on line 77 Quote Link to comment https://forums.phpfreaks.com/topic/117876-solved-dowhile/ Share on other sites More sharing options...
wildteen88 Posted August 2, 2008 Share Posted August 2, 2008 You code will always timeout if $e is not equal to 1, as $i is not being incremented I cannot see the purpose of the do .. while loop Quote Link to comment https://forums.phpfreaks.com/topic/117876-solved-dowhile/#findComment-606314 Share on other sites More sharing options...
zackcez Posted August 2, 2008 Author Share Posted August 2, 2008 Umm, would you have a function in mind you could suggestion :s? Quote Link to comment https://forums.phpfreaks.com/topic/117876-solved-dowhile/#findComment-606315 Share on other sites More sharing options...
wildteen88 Posted August 2, 2008 Share Posted August 2, 2008 If you don't to perform a loop, then remove the do while. What are you trying to achieve with the above code Quote Link to comment https://forums.phpfreaks.com/topic/117876-solved-dowhile/#findComment-606317 Share on other sites More sharing options...
zackcez Posted August 2, 2008 Author Share Posted August 2, 2008 I'm attempting to make it search through the database to get one result, the user with the highest value that also has $e of 0.... Also here would be the function: function getExclude($id) { $excludeQuery = mysql_query("SELECT * FROM usergroup WHERE usergroupid='$id'"); $excludeData = mysql_fetch_array($excludeQuery); switch ($excludeData['highscores_perms']) { case 2: $exclude = 1; break; case 3: $exclude = 1; break; default: $exclude = 0; break; } return $exclude; } Quote Link to comment https://forums.phpfreaks.com/topic/117876-solved-dowhile/#findComment-606318 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.