I want to create a mega menu like
http://www.libertyeaglearms.com/dev/
my code goes here:

PHP Code:
<div id="menu">
  <ul>
    <?php foreach ($categories as $category) { ?>
    <li><a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
      <?php if ($category['children']) { ?>
      <div>
        <?php for ($i 0$i count($category['children']);) { ?>
        <ul>
          <?php $j $i ceil(count($category['children']) / $category['column']); ?>
          <?php for (; $i $j$i++) { ?>
          <?php if (isset($category['children'][$i])) { ?>
          <li><a href="<?php echo $category['children'][$i]['href']; ?>"><?php echo $category['children'][$i]['name']; ?></a></li>
          <?php ?>
          <?php ?>
        </ul>
        <?php ?>
      </div>
      <?php ?>
    </li>
    <?php ?>
  </ul>
</div>
And my database is as follows:
category_id name
63 Decor
64 kitchen
65 bar

category_id path_id
65 65
64 63
63 63
65 63
65 64
64 64