That does work, I did have a look at the code when its been parsed from the server, and it leaves '<tr><td></td></tr>' at the end, but I can work that out anyway, so thanks.
What I'm trying to do now is to display the subcategories beneath the main category. Now what I have done is created a function so that it calls itself so that it displays the subcategories.
order by cat_name";
echo "<td valign=top>$DBcatname</td>";
<table cellpadding="2" cellspacing="2" border="1" width="70%">
Is this the right way?