Remove link in supersub category PHP Mysql -


i have problem active link i've created. want make sub category doesn't have link, supersub have link each supersub category.

the example like: 1. painting (category), 1.1 hobe (sub category), 1.1.1 sealer, 1.1.2 wall paint (supersub category)

the table contain: id_kategori, kategori, id_parent

this code:

<?php include "config.php";  function punya_child($id_kategori = null) { $result = mysql_query('select count(id_kategori) jumlah_child category id_parent = \''.$id_kategori.'\''); $data = mysql_fetch_assoc($result); if($data['jumlah_child'] > 0) return true;     return false; }  function hirarki($id_kategori = null) {    if($id_kategori === null)    {     $result_top_level = mysql_query('select * category id_parent null');             if(mysql_num_rows($result_top_level) > 0)     {         echo '<ul class="category">';                     while($row_top_level = mysql_fetch_assoc($result_top_level))         {             echo "<li class='category'>", $row_top_level['kategori'];                             if(punya_child($row_top_level['id_kategori']))             {                 hirarki($row_top_level['id_kategori']);             }                             echo '</li>';         }                     echo '</ul>';     } } else {     $result_child = mysql_query('select * category id_parent = \''.$id_kategori.'\'');         if(mysql_num_rows($result_child) > 0)     {         echo '<ul class="subcategory">';                 while($row_child = mysql_fetch_assoc($result_child))         {             echo "<li><a href='cat.php?kategori=$row_child[kategori]'>", $row_child['kategori'];             if(punya_child($row_child['id_kategori']))             {                 hirarki($row_child['id_kategori']);             }                         echo '</li>';         }             echo '</ul></a>';     } } } hirarki(); ?> 

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 -