Hi guys,
i have this problem with loop in my template the categories and sub-categories.
Example whit image categories:

and image sub-categories

Now i use this code PHP in the template but i dont like this....Beacuse is not dinamic for the image in the table menu

$dati = $connetti->query("SELECT * FROM tbl_blog_categoria WHERE cat_parent_id = 0 ORDER BY cat_ordine");
while($array = $connetti->fetchArray($dati)){
echo"<tr><td height=\"25\" >
<a href=\"?azione=categorie&cat_id=$array[cat_id]\">$array[cat_nome]</a><br></td>";
$dati2 = $connetti->query("SELECT * FROM tbl_blog_categoria WHERE cat_parent_id = $array[cat_id]");
while($array2 = $connetti->fetchArray($dati2)){
$sottocategoria = substr($array2[cat_nome],0 , $caratteri);
if($array2[cat_parent_id] == $_GET[cat_id])
echo"</tr><tr><td height=\"25\" >
- <a href=\"?azione=categorie&cat_id=$array[cat_id]&categoria=post&parent_id=$array2[cat_id]\">$sottocategoria</a>
<br></td>" ;
I can make?
Any example
Thanks, sorry for my english