If 'it still looks the same', that means you haven't used either my code or Rachels.
Your code yields a mess: you add an end table tag</table> with every iteration of your while loop (which is a lot like adding close parentheses that aren't strictly speaking needed)))))))))))))))))))))))), and your <td> and<tr> tags are also wildly out of place.
Rachel's code provides a single long row of cells containing names.
My code provides that each name cell appears in its own row.
The results of the either new code will not 'look the same' as your old code, unless, as seems likely from the oddities in your example code, you have other vagaries in the HTML associated with this code.