Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sql = $azdb->get_row("SELECT * FROM ".$table_prefix."_content WHERE ID='".$_GET['ID']."'");
- if($sql):
- echo '<h2>'.$sql->content_title.'</h2>';
- echo date('d m Y',strtotime($sql->content_modified));
- echo '<br />';
- echo $sql->content;
- endif;
- $sql = $azdb->get_results("SELECT * FROM ".$table_prefix."_content WHERE content_parent='".$_GET['ID']."'");
- if($sql): foreach($sql as $sql):
- echo '<div class="comments">';
- echo '<h2>Main '.$sql->content_title.'</h2>';
- echo date('d m Y',strtotime($sql->content_modified));
- echo '<br />';
- echo $sql->content;
- echo '<br />';
- $sql1 = $azdb->get_results("SELECT * FROM ".$table_prefix."_content WHERE content_parent='".$sql->ID."'");
- if($sql1): foreach($sql1 as $sql1):
- echo '<div class="comments">';
- echo '<h2>'.$sql1->ID.' - '.$sql1->content_title.'</h2>';
- echo date('d m Y',strtotime($sql1->content_modified));
- echo '<br />';
- echo $sql1->content;
- $sql2 = $azdb->get_results("SELECT * FROM ".$table_prefix."_content WHERE content_parent='".$sql1->ID."' ");
- if($sql2): foreach($sql2 as $sql2):
- echo '<div class="comments">';
- echo '<h2>'.$sql2->content_title.'</h2>';
- echo date('d m Y',strtotime($sql2->content_modified));
- echo '<br />';
- echo $sql2->content;
- echo '</div>';
- endforeach; endif;
- echo '</div>';
- endforeach; endif;
- echo '</div>';
- endforeach; endif;
- $id = isset($_GET['id']) ? $_GET['id'] : 0;
- $root_sql = $azdb->get_results("SELECT * FROM categories WHERE cat_parent = " . $id);
- recursive_categories($root_sql);
- function recursive_categories($results)
- {
- if(count($results))
- {
- echo "<ul>";
- foreach($results as $res)
- {
- echo "<li>" . $res->category;
- //Rest of what ever you want to do with each row
- //Check this category for children
- $rows = $azdb->get_results("SELECT * FROM categories WHERE cat_parent = " . $res->id);
- recursive_categories($rows);
- //has to be after the inner loops
- echo "</li>";
- }
- echo "</ul>";
- }
- }
- 1 - main
- 1.1 - comment 1
- 1.2 - comment 2
- 1.2.1 - nested comment for comment 2
- 1.2.1.1 - nested comment for comment 2, nested comment 1
- 1.2.2
- 1.2.3
- 1.2.2.1
- 1.1.1 - (this comment you could order by your sql call to be 3rd from the top, etc)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement