Deeper Sub Category with php mysql -


i have problem creating multiple sub category php , mysql deeper sub category doesn't indented. screenshot like:
enter image description here.
sealer , wall paint should indented hobe.

ex: 1. painting, 1.1 hobe, 1.1.1 sealer, 1.1.2 wall paint

i have 3 table:

  1. kategori contain: id_kat, nama_kat

  2. subkategori contain: id_subkat, id_kat, nama_subkat

  3. supersubkategori contain: id_supersub, id_subkat, id_kat, nama_supersub

my code is:

include "config.php"; $sql = mysql_query("select * kategori"); while($data=mysql_fetch_array($sql))  {     echo "<li>".$data['nama_kat'].""; // kategori      $sql2 = mysql_query("select * subkategori id_kat = '".$data['id_kat']."'"); // sub kategori     if($sql2)      {         echo "<ul>";             while($data2=mysql_fetch_array($sql2))              {                 echo "<li>".$data2['nama_sub']."</li>";             }         echo "</ul>";     }     echo "<li>";         $sql3 = mysql_query("select * supersubkategori id_kat = '".$data['id_kat']."'"); // supersub kategori         if($sql3)          {             echo "<ul>";                 while($data3=mysql_fetch_array($sql3))                  {                     echo "<li><a href='cat.php?kategori=$data3[nama_supersub]'>".$data3['nama_supersub']."</a></li>";                 }             echo "</ul>";         }      else      {         echo "</li>";     }  } ?> 

i thankful if can me how solve problem. thank you


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -