hello friends i'm using the boostrap menu for my website it was fine until i wanted to get menu element from database so u got the syntax error unexpected '<' in line 3 and the line 5, 6, 7, 9, 10, are shown red in my IDE i gues if i solve the line 3 i will get the same message for that lines too !

<?php
            while($row=mysqli_fetch_array($sqldonee, MYSQLI_ASSOC)){
             <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="caret"></span></a>
              <ul class="dropdown-menu">
                <li><a href="#">Action</a></li>
                <li><a href="#">Another action</a></li>
                <li><a href="#">Something else here</a></li>
                <li role="separator" class="divider"></li>
                <li><a href="#">Separated link</a></li>
                <li role="separator" class="divider"></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
            ?>
Member Avatar for diafol

How experienced are you with PHP? You can't have raw text inside a loop. It needs to be echoed. In any case the code above makes no sense. You aren't echoing anything from the DB.

not expert! so i took time try fix it seems like i found what was wrong but i found i litle problem, no error or warning but the echo is not echoing something

<?php 
    include('./db/cnntdb.php');
    $sqlrecup= "SELECT * FROM main";
    $sqldonee= mysqli_query($cnndb, $sqlrecup) or die('could not get data');
    while($row=mysqli_fetch_array($sqldonee, MYSQLI_ASSOC)){
        //echo $row['main']; this can diplay the data if i delet the comment but echo in li tag below doesn't display anything
    }
?>
<?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">
                <li><a href="#">Action</a></li>
                <li role="separator" class="divider"></li>
                <li><a href="#">Separated link</a></li>
                <li role="separator" class="divider"></li>
                <li><a href="#">One more separated link</a></li>
              </ul>
            </li>
            <?php } while ($row=mysqli_fetch_assoc($sqldonee));?>

is somebody here i really need help

Member Avatar for diafol

The first mysqli_fetch_array loop, although you comment out actions, moves the internal data pointer ahead to the end. So, the second time you call it, it has nowhere to go as the internal pointer is at the end. Comment out the first loop entirely and it may work.

Be a part of the DaniWeb community

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