chrisschristou 0 Posting Whiz

hello i'm just training myself on web development so i wanted to create a drop down menu wich i have post before about it!
so i get the html code and css and the javascrip code of the bootstrap header menu and i want to customize it for my website menu, but the problem is in my data base i have 3 data but my meny displays only 2 and in the first drop down there is an error that is not in second and i can't figure out why the above pictures and my code explain lite more cleary !

<head>
<?php 
    include('./db/cnntdb.php');
    $sqlrecup= "SELECT * FROM main";
    $sqldonee= mysqli_query($cnndb, $sqlrecup) or die('could not get data');
    $row=mysqli_fetch_array($sqldonee, MYSQLI_ASSOC);
?>
</head>
//and here is the menu
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">HOME<span class="sr-only">(current)</span></a></li>
            <?php do { ?>
             <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <?php echo $row['main'];
    ?>
    <span class="caret"></span></a>
              <ul class="dropdown-menu">
              <?php
    $mainsub=$row['idmain'];
    $sqlsub = "SELECT * FROM `sub` WHERE `main` = '$mainsub' ";
    $sqlsubdonee= mysqli_query($cnndb, $sqlsub) or die('could not get data');
    $sub=mysqli_fetch_array($sqldonee, MYSQLI_ASSOC);?>
                <?php do{ ?>
                <li role="separator" class="divider"></li>
                <li><a href="#"><?php echo $sub['sub'];?></a></li>
                <?php } while ($sub=mysqli_fetch_assoc($sqlsubdonee));?>
                <li role="separator" class="divider"></li>
              </ul>
            </li>
        <?php } while ($row=mysqli_fetch_assoc($sqldonee));?>
          </ul>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.