Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    May 2006
    Posts
    107
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Problem with recursion

    I have categories up to n levels and my db is like:
    Category: catid,catname,parent

    parent = n //where n is the value of parent category


    PHP Code:
    function myFun($id)
    {
        
    $res mysql_query("select * from categories where parent=".$id."") or die("Here is error");
        while(
    $row mysql_fetch_array($res))
        {
            
    myFun($row["catid"])
        }
    }
    myFun2(2
    but this is not workin
    any help?

    thank you

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    myFun2(2) ?
    You have defined myFun($id) only!
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •