×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: IGA JOHN BOSCO
Added: May 23, 2017 3:43 PM
Views: 2332
  1. <?php
  2. require "includes/dbconfig.php";
  3. require 'includes/functions.php';
  4. $pagetitle = 'Home';
  5. require "includes/headerlinks.php";
  6. require 'includes/mainMenu.php';
  7. ?>
  8. <body>
  9.     <div class="container main_container">
  10.         <div id="nav">
  11.             <ul>
  12.                 <?php
  13.                 while ($row = $stmt->fetch(PDO::FETCH_OBJ)) {
  14.                     $sub_sql = "SELECT * FROM submenu WHERE cat_id =:id";
  15.                     $sub_stmt = $pdo->prepare($sub_sql);
  16.                     $sub_stmt->bindParam(':id', $row->id, PDO::PARAM_INT);
  17.                     $sub_stmt->execute();
  18.                     ?>
  19.                     <li><a href=""><?php echo $row->name ?></a>
  20.                         <?php if ($sub_stmt->rowCount()) {
  21.                             ?>
  22.                             <ul>
  23.                                 <?php
  24.                                 while ($sub_row = $sub_stmt->fetch(PDO::FETCH_OBJ)) {
  25.                                     ?>
  26.                                     <li><a href="<?php echo $sub_row->href; ?>">
  27.                                             <?php echo $sub_row->sub_name; ?>
  28.                                         </a></li>
  29.                                     <?php
  30.                                 }
  31.                                 ?>
  32.  
  33.                             </ul>
  34.                         <?php }
  35.                         ?>
  36.                     </li>
  37.                     <?php
  38.                 }
  39.                 ?>
  40.             </ul>
  41.         </div>
  42.  
  43.     </div>
  44.     <?php
  45.     require "includes/footerlinks.php";
  46.  
  47.