When posting in the html & css forum, it’s best to show just html & css code. Showing the php just confuses things. Show the result of the php.
But from what I can decipher of your code, the html is all wrong.
You start with an opening table tag, then open a ul, followed by a h4, then an li. This is completely invalid code. This is wrong in more ways than I would wish to describe.
Not to mention the continued use of the obsolete mysql api.
Maybe best to describe the end result you want and start over.
It looks like what you actually want is a table, which as tables should do, contain rows, not lists, which are naturally horizontal.
I believe I already showed you how to output a table from a database here.
But still, looking at your code, I think you need to go and learn some basic principles of html. There are too many mistakes that would not pass validation.
<font>
</font>
Font tags are obsolete, don’t use them, they didn’t belong in the head section anyway.
Using in-line styling via the style attribute is bad practice, don’t do it. In this case, being an img it is good practice to set the width and height, but do it via the height and width attributes:-
A <ul> element cannot be a direct descendant of a <table> element.
An <h4> cannot be a direct descendant of a <ul> element. The h4 should only be used as a fourth level heading, that is a heading to a section of content nested beneath previous levels of h1, h2 and h3.