SirChick Posted January 14, 2008 Share Posted January 14, 2008 My while loop is looping almost 4 more times than it should be.. there for it echo's the same rows in my database 4 times rather than just once.. which is a bit strange. This is what i got: <?php //select recordid from reportedusers where the same recordid is not found in reportsituation table $GetAppeals = mysql_query("SELECT * FROM reportedusers, reportsituation WHERE reportedusers.RecordID <> reportsituation.RecordID") or die (mysql_error()); while($row = mysql_fetch_array($GetAppeals)) { echo 'stuff'; } ?> It should do none for echo's as record Id can be found in the report situation table. Is my query wrong or my while loop ? Quote Link to comment https://forums.phpfreaks.com/topic/85953-my-while-looploops-too-many-times/ Share on other sites More sharing options...
kenrbnsn Posted January 14, 2008 Share Posted January 14, 2008 You just show "echo 'stuff'", can you show us what your real echo is? It's not clear from your description. Ken Quote Link to comment https://forums.phpfreaks.com/topic/85953-my-while-looploops-too-many-times/#findComment-438829 Share on other sites More sharing options...
SirChick Posted January 14, 2008 Author Share Posted January 14, 2008 Oh ok here you go : While loop: <?php while($row = mysql_fetch_array($GetAppeals)) { $RecordID = $row['RecordID']; $ReportedPlayer = $row['ReportedPlayer']; $Reason = $row['Reason']; $FrozenBy = $row['FrozenBy']; //Get reported Player's name $GetUsername = mysql_query("SELECT Username FROM userregistration WHERE UserID='$ReportedPlayer'") Or die(mysql_error()); $GetUsernameRow = mysql_fetch_assoc($GetUsername); $Username = $GetUsernameRow['Username']; If($Username == ''){ $Username = '--Deleted User--'; } //Get Frozen By name $GetUsername2 = mysql_query("SELECT Username FROM userregistration WHERE UserID='$FrozenBy'") Or die(mysql_error()); $GetUsername2 = mysql_fetch_assoc($GetUsername2); $Username2 = $GetUsername2['Username']; ?> <tr> <td width="100" align="center"><span class="NegativeMoney"><?=$Username?>[<?=$ReportedPlayer?>]</span></td> <td width="100" align="center"><?=$Reason?></td> <td width="100" align="center"><span class="PositiveMoney"><?=$Username2?>[<?=$FrozenBy?>]</span></td> <td width="100" align="center"><span class="PositiveMoney">Awaiting staff response!</span></td> <td width="100" align="center"><a href="frozenaccont2.php?RecordID=<?=$RecordID?>">View Appeal</a></td> </tr> <?php } ?> Quote Link to comment https://forums.phpfreaks.com/topic/85953-my-while-looploops-too-many-times/#findComment-438831 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.