Deeper Sub Category with php mysql -
i have problem creating multiple sub category php , mysql deeper sub category doesn't indented. screenshot like:
.
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:
kategori contain: id_kat, nama_kat
subkategori contain: id_subkat, id_kat, nama_subkat
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
Post a Comment