用PHP显示导航栏

i have the below code for my navigation bar... (the sub menu bit - dropdown)

<div class="column" style="width:50%">
<ul>
<li><a href="#">LINK</a></li>
</ul>
</div>

and each ...

I have this PHP code to display data in the dropdown part of the menu from a database

<div class="column" style="width:50%">
                <ul>
                <?php
                $menu1="SELECT * from websitepages where pagetype = 'About' order by pagedesc ASC ";
                $menu2=mysql_query($menu1,$conn) or die(mysql_error());
                $counter=0;
                while($menu3=mysql_fetch_array($menu2))
                {
                    $counter++;
                    echo '<li><a href="/index.php?p='.$menu3["pagename"].'">'.$menu3["pagedesc"].'</a></li>';
                    if($counter==2) { echo '</ul></div>'; $counter=0; }
                }
                ?>

and i basically need it to display 2 items from the database (it gets the number displayed from the $counter variable)

so when it gets to 2 items, it closes the and then re-opens it with the and starts a new column and displays the same amount of items again but obviously not the same items already displayed.

Anyone got any ideas as i cannot work out how to get it working for some reason

You haven't opened the <ul> again; only closed it. Change to:

if($counter==2) { echo '</ul></div><div class="column" style="width:50%"><ul>'; $counter=0; }

And then after the loop close with a </ul></div>. So the full code:

<div class="column" style="width:50%">
            <ul>
            <?php
            $menu1="SELECT * from websitepages where pagetype = 'About' order by pagedesc ASC ";
            $menu2=mysql_query($menu1,$conn) or die(mysql_error());
            $counter=0;
            while($menu3=mysql_fetch_array($menu2))
            {
                $counter++;
                echo '<li><a href="/index.php?p='.$menu3["pagename"].'">'.$menu3["pagedesc"].'</a></li>';
                if($counter==2) { echo '</ul></div><div class="column" style="width:50%"><ul>'; $counter=0; }
            }
            ?>


</ul>
</div>

If I understood it correctly, you probably just forgot to re-open the ul and div in the if; do this instead:

 if ($counter==2) {
   echo '</ul></div> <div class="column" style="width:50%"><ul>';
   $counter=0;
 }