How to generate breadcrumbs using recursion on database row data?
问题 I have to make a breadcrumb menu which comes database. So made this function function file_list($path) { $result = array(); $q = "SELECT staticTitle,staticId,parentId FROM tbl_static_pages WHERE staticId = $path"; $run = mysql_query($q); while($row = mysql_fetch_array($run)) { if($row['parentId'] > 1) { echo $row['staticTitle']; $result = file_list($row['parentId']); return $result; // INSERTED }else { return $result; } } I have a database structure like this: id | parentId | title 3 | 1 |