
<aside id="column-left" class="col-sm-3 hidden-xs">
  <?php
  $sql  = mysqli_query($conn,"SELECT * FROM main_cat ORDER BY id ASC");
  while($row = mysqli_fetch_array($sql)){
    $menu = $row['id'];
    ?>
    <div class="sblock-1">
      <h5 class="sblock-1-heading"><?php echo $row['name']; ?></h5>
      <div class="sblock-1-content">
        <div class="list-group animation">
          <?php
          $sql_cat  = mysqli_query($conn,"SELECT
            sub_cat_mapping.sub_cat_name,sub_cat_mapping.sub_cat
            FROM
            cat
            Inner Join sub_cat_mapping ON cat.cat_id = sub_cat_mapping.main_cat
            Inner Join sub_cat ON sub_cat_mapping.sub_cat = sub_cat.sub_cat_id
            WHERE
            cat.menu_id = $menu LIMIT 5");
          while($row_cat = mysqli_fetch_array($sql_cat)){
           ?>

           <a href="publications.php?cid=<?php echo $row_cat['sub_cat']; ?>" class="list-group-item"><?php echo $row_cat['sub_cat_name']; ?></a>

         <?php } ?>
       </div>
     </div>  
   </div>
 <?php } ?>

</aside>
