Results 1 to 9 of 9

Thread: Calling a function within itself *resolved*

Threaded View

  1. #1

    Thread Starter
    Fanatic Member Graff's Avatar
    Join Date
    Jan 2002
    Location
    Calgary
    Posts
    668

    Calling a function within itself *resolved*

    I'm having a problem with a peice of code, it will execute fine except it won't go into the call.

    Code:
    function GetSubCategory($id,$str,$folder)
    	{
    		$db = OpenDB();
    		
    		$r = mysql_query("SELECT category_id,name,folder FROM category WHERE category_id <> ".$id." AND category_parent_id = ".$id,$db);
    		
    		while($row = mysql_fetch_array($r))
    		{
    			$r2 = mysql_query("SELECT count(*) as pages FROM Page p, category c WHERE p.category_id = c.category_id AND c.category_id = ".$row['category_id'],$db);
    			$row2 = mysql_fetch_array($r2);
    			$pages = $row2['pages']-1;		//ignore the index.php
    			$folder += $row['folder']; 		//append new folder to existing
    			echo $str."<a href='".$folder."'>".$row['name']." (".$pages.")</a><br>\n";
    			$str += "<a href='".$folder."'>".$row['name']."</a>&gt;&gt;";
    			GetSubCategory($row['id'],$str,$folder);
    		}
    		CloseDB($db);
    	
    	}

    I don't get any warnings or error messages, it just stops.
    Last edited by Graff; Jan 26th, 2004 at 05:12 AM.
    If wishes were fishes we'd all cast nets.

Posting Permissions

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



Click Here to Expand Forum to Full Width