Some assistance with tables layout in an email breaking whole email code enclosed

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Some assistance with tables layout in an email breaking whole email code enclosed

Heres what I am trying to do, I have a php script that creates a piece of html (enclosed) that is entered into a database for phplist a mailinglist.

This forms the html message that the list sends out, now within this html message there is a table containing 7 rows of 3 columns and for some reason the final cell (bottom right) is messed up and it in turn messes up everything that comes after it in the code of the rest of the email, so some text doesnt display right and some of the border to the right and bottom doesnt display either.

I tested this using a table with only 3 across and 1 down an 3 by 6 and 3 by 7 and the couple of tests I did with each seemed to work for all the ones that had less than 18 total cells, but as soon as I got to 18 total table cells one test worked and one didnt, then when i tried 21 total cells (3 by 7) that didnt work either in any test, and then when i tried 24 cells it looked exactly like the 21 cell test, so the last row of the table was removed completely for some reason.

Code available to check here code with issues.txt and I checked it in Windows Live Mail on Windows 7 machine for my email program.

I do not see anything obvious in the code causing it and why different number of rows causes different results? when each row is dynamically generated via php using the same code so only difference between each row is the content in the cell, just text and an image.

Just to add, the actual thing should have a red border all around the edge, some logos to the left and a table 3 by 7 to the right each cell contains another table containing a title photo description and a more link, it is the red border around the right and bottom that breaks as well as the bottom right table cell and all the text that appears after it that is messed up or not displaying at all.

Works fine when viewing within the mailinglist script phplist admin area, looks ok in dreamweaver too and not seeing any errors of unclosed tags or things nested wrong, but in email it looks messed up.