Created
April 10, 2021 06:06
-
-
Save tienloc1/60707a0ee3449a450ef93cec70007c0e to your computer and use it in GitHub Desktop.
sidebar for learn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="content-container"> | |
| <div id="section-navigation"> | |
| <ul class="navi"> | |
| <?php | |
| // Cau lenh truy xuat categories | |
| $q = "SELECT cat_name FROM categories ORDER BY position ASC"; | |
| $r = mysqli_query($dbc, $q) or die("Query {$q} \n<br/> MySQL Error: " . mysqli_error($dbc)); | |
| while($cats = mysqli_fetch_array($r, MYSQLI_ASSOC)) { | |
| echo "<li><a href='index.php'>" . $cats['cat_name'] . "</a>"; | |
| // Cau lenh truy xuat pages | |
| $q1 = "SELECT page_name, page_id FROM pages WHERE cat_id={$cats['cat_id']} ORDER BY position ASC"; | |
| $r1 = mysqli_query($dbc, $q1) or die("Query {$q1} \n<br/> MySQL Error: " . mysqli_error($dbc)); | |
| echo "<ul class='pages'>"; | |
| // Lay pages tu csdl | |
| while($pages = mysqli_fetch_array($r1, MYSQLI_ASSOC)) { | |
| echo "<li><a href=''>" . $pages['page_name'] . "</a></li>"; | |
| } // End WHITE pages | |
| echo "</ul>"; | |
| echo "</li>"; | |
| } // End WHILE cats | |
| ?> | |
| </ul> | |
| </div><!--end section-navigation--> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment