Jump to content

pl0x

New Members
  • Posts

    1
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

pl0x's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I have this code, but result is empty ... Help me =) <?php $a_tree=array(); $r=mysql_query("select c.id,c1.id as qqq, c.name from catalog c left join catalog c1 on c.parentcatalog=c1.id order by c.name"); for($i=0;$i<mysql_num_rows($r);$i++) { $f=mysql_fetch_assoc($r); if(empty($a_tree[$f['id']])) $a_tree[$f['id']]=array(); $a_tree[$f['id']][]=$f; } function tree_print($a_tree,$k_parent=0) { if(empty($a_tree[$k_parent])) return; echo "<ul>"; for($i=0; $i < count($a_tree[$k_parent]);$i++) { echo "<li>".$a_tree[$k_parent][$i]['name']; tree_print($a_tree,$a_tree[$k_parent][$i]['id']); echo "</li>"; } echo "</ul>"; } tree_print($a_tree); ?>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.