The following goes into an endless loop, meaning it just constantly shows the same record over and over and over again.
<?php
while ($rowr = mysql_fetch_assoc(mysql_query("SELECT * FROM table1")) {
while($rowu = mysql_fetch_assoc(mysql_query("SELECT * FROM table2 WHERE id = '".$rowr['uid']."'"))){
while($rowc = mysql_fetch_assoc(mysql_query("SELECT * FROM table3 WHERE id = '".$rowr['cid']."'"))){
?>
<tr><td><?php echo $rowc['post']; ?></td><td><a href="other.php?id=<?php echo $rowu['id']; ?>"><?php echo $rowu['username']; ?></a></td><td><a href="this.php?p=d&i=<?php echo $rowr['id']; ?>"><font color="#FF0000">X</font></a></td></tr>
<?php
};
};
};
?>
Why does that happen and how can I fix it?
You are putting the mysql query in the
whilestatement so every time it gets there it does the same query and shows the same first record, you are never advancing to the next record in the result set.Personally I would combine all queries into one, but to show how you can solve your problem (the same applies to all loops):