Jump to content

Doing a recursive category system, Stuck..


flamerail

Recommended Posts

Ok, So heres the simple development code.

<select name="select">

	<?
	$query = mysqli_query(core_db(),"SELECT * FROM article_cat WHERE parent_id = '0'");
	while($cat = mysqli_fetch_array($query)){
	echo '<option value="'.$cat['id'].'">'.$cat['name'].'</option>';

	}
	?>
        </select>

 

article_cat is setup (ID | NAME | PARENT_ID) Essentially if the cat is parent_id 0 its the root level, and any sub level category sets parent_id as the category id before it, I have no Idea how to recursively loop this, Any ideas?

 

Thanks!

Link to comment
https://forums.phpfreaks.com/topic/93253-doing-a-recursive-category-system-stuck/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.