ersin d

ersin d

Joined
May 08, 2009

Activity Stream

ersin d commented on a Page, Parent/Child Category Tree  -  May 08, 2009

Thanks for the code but i tried my before seen this code it helpme alot

this i writed before seen your code...

<?php

$dbconn = @mysql_connect("localhost","ersin","") or die("DB ERROR");
@mysql_select_db("cats",$dbconn) or die("DB ERROR");

function childcat($id,$name){
$query = "SELECT * FROM categories WHERE parent='$id'";
$result = @mysql_query($query) or die ("Table doesn't exists!");
while($row = mysql_fetch_array($result)){
echo "

  • -$row[name]";
    $id = $row['id'];
    $name = $row['name'];
    childcat($id,$name);
    echo "";
    }
    echo "
";
}

$query = "SELECT * FROM categories WHERE parent='0'";
$result = @mysql_query($query) or die ("Table doesn't exists!");
echo "

  • ";
    while($row = mysql_fetch_array($result)){
    echo "$row[name]";
    $name = $row['name'];
    $id = $row['id'];
    childcat($id,$name);
    echo "";
    }
    echo "
";

echo "


";
?>
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.