did you have the table's tag started?
I mean did you print any <table border="0" width=" ... > before you start the tables <tr>s and <td>s ?

because in your code you don't seem to have it !
also you don't need all this echos !! just one is enough !
PHP will ignore any spaces or newlines in your code ..
now, doesn't this look cleaner !!
