Ahh... Is it because your foreach loop is happening inside your while loop? Methinks it probably is!
Does this serve you any better?
mysql_connect("localhost","backdoor","(*****)");
$tables = mysql_list_tables("dbase");
$count = 0;
while ($count < mysql_numrows($tables)) {
$category = array(mysql_tablename($tables,$count).",");
$category = str_replace(",", "", $category);
$count++;
}
echo '';
foreach ($category as $key => $value) {
echo ''.$value.'';
}
echo '';
//'mysql_tablename($tables,$count).'';
//echo mysql_tablename($tables,$count)."
";
?>