this is part of a table - and it works <tr align="center"> <?php // first loop $get = $DB->query("SELECT * FROM $t[fam] WHERE uid = '$uid' ORDER BY id ASC limit ".($rows*3).", 3", __FILE__, __LINE__); while ($results = $DB->fetch_array($get)){ ?> <td align="center" width="33%"> <?=$results['name']?> </td> <? }?> </tr> PHP: but now when I add another loop inside this one: <tr align="center"> <?php // first loop $get = $DB->query("SELECT * FROM $t[fam] WHERE uid = '$uid' ORDER BY id ASC limit ".($rows*3).", 3", __FILE__, __LINE__); while ($results = $DB->fetch_array($get)){ ?> <td align="center" width="33%"> <?=$results['name']?> <?php // second loop $get = $DB->query("SELECT * FROM $t[mob] WHERE fam = '$results[id]' ORDER BY networth ASC", __FILE__, __LINE__); while ($memb = $DB->fetch_array($get)){ ?> <br><?=moblink($memb['mob'],$rnd)?> <? }?> </td> <? }?> </tr> PHP: It does not work properly. I need the list of "<br><?=moblink($memb['mob'],$rnd)?>" to be under the text the first loop creates. Results with first loop only: Text1 Text2 Text3 (columns in a row) However, when I enter the second loop I expect this: Text1 Text2 Text3 bla1 bla2 bla3 bla1 bla2 bla3 bla1 bla2 bla3 bla1 bla2 bla3 bla1 bla2 bla3 Instead I get: Text1 bla1 bla1 bla1 bla1 bla1 What am I doing wrong? This all is in another loop btw that creates more rows in the table in case there are more results than three (three per row). But I didn't think that's relevant.
You're using the same $get result for both queries which leads to the loop ? Try using a different value?
I will create a function for the second loop and make the list outside the big loop... Annoying. I would still like to know why my code did not work. EDIT: to ibg: trying...