keldorn Posted November 23, 2009 Share Posted November 23, 2009 function build_child($oldID) // Recursive function to get all of the children...unlimited depth { global $exclude, $depth; $tempTree = ""; $child_query = mysql_query("SELECT * FROM `categories` WHERE parent='{$oldID}' AND depth <=1") or die(mysql_error()); while( $child = mysql_fetch_array($child_query) ) { if ( $child['id'] != $child['parent'] ){ for ( $c=0;$c<$depth;$c++ ){ $tempTree .= "<li>{$child['name']}"; } $tempTree .= $child['name'] . "</li>\n"; $depth++; /* Greetings, I heard that you like functions, So I have placed this function inside itself, thus allowing you to derive while you derive. */ $tempTree .= build_child($child['id']); $depth--; array_push($exclude, $child['id']); } } return $tempTree; // Return the entire child tree } Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/ Share on other sites More sharing options...
seventheyejosh Posted November 23, 2009 Share Posted November 23, 2009 LMAO, reminds me of this. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-963719 Share on other sites More sharing options...
corbin Posted November 23, 2009 Share Posted November 23, 2009 You just came across that in random code? If so, that's quite awesome. Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-963722 Share on other sites More sharing options...
iversonm Posted November 23, 2009 Share Posted November 23, 2009 Ahhh Clearly Genius hahaha Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-963753 Share on other sites More sharing options...
keldorn Posted November 23, 2009 Author Share Posted November 23, 2009 Yo Dawgs I heard your down with recursion so I put recursion in yo recursion so you can repeat while you repeat. LMAO, reminds me of this. There this one too. xD [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-963782 Share on other sites More sharing options...
keldorn Posted November 23, 2009 Author Share Posted November 23, 2009 function recursion() { print("I heard you like functions so I placed a function inside a function, allowing you to derive while you derive"); recursion(); } recursion(); Okay I'm done. Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-963788 Share on other sites More sharing options...
nrg_alpha Posted November 24, 2009 Share Posted November 24, 2009 That's trippie! Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-965026 Share on other sites More sharing options...
mikesta707 Posted November 24, 2009 Share Posted November 24, 2009 Yo dawg, I heard you like yo yo's so I put a yo yo in your yo yo so you can yo yo while you yo yo yo yo Quote Link to comment https://forums.phpfreaks.com/topic/182584-lol/#findComment-965043 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.