Page 1 of 1

While loop issue[solved]

Posted: Mon Jan 14, 2008 8:21 am
by Snobbery08
My while loop is echo'in incorrectly but i am not sure if i have my query wrong or my while loop. It should not echo anything as the record id is found on the other table yet it still echo's the information :S


Code: Select all

 
<?php
$GetAppeals = mysql_query("SELECT * FROM reportedusers, reportsituation WHERE reportedusers.RecordID <> reportsituation.RecordID")
  or die (mysql_error());  
 
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
        }
?>

Re: While loop issue

Posted: Mon Jan 14, 2008 10:56 am
by pickle
The only IF condition you have is the one that overwrites a blank username - nothing that decides if anything is output or not.

Re: While loop issue

Posted: Mon Jan 14, 2008 2:37 pm
by Snobbery08
Yeah i think its an issue with my query. I will post a topic in the mysql section to see what they can come up with.

Thankyou.