-2

I am trying to make my dynamic site in php by learning from tutorials and google search. I am stuck in one place.

I want sub-menu from the database i.e SQL. so when user add category in category section in sql then sub should come from the entered categories but it appears empty . Here is the code

<ul class="menu">
<li><a href="index.php">Home</a></li>
<li><a href="about-us.php">About Us</a></li>
<li><a href="#">Products</a>
<ul class="submenu pop">
<?php
$result = mysqli_query ($con,"SELECT CategoryId,CategoryName FROM category ORDER BY CategoryId ASC");
while ($row=mysqli_fetch_array($result))
?>
<li><a href='#'><?php echo $row['CategoryName'];?></a></li>
</ul>
</li>
<li><a href="construction.php">Directors</a></li>
<li><a href="contact-us.php">Contact Us</a></li>
</ul>

Also please tell me any easiest way for pagination.

4

2 回答 2

0

我认为您的 while 循环中没有打开和关闭花括号{ }

有关可用插件,请参阅此http://www.jquery4u.com/plugins/10-jquery-pagination-plugins/

于 2013-06-24T07:32:46.857 回答
0

试试你的代码: -

<ul class="menu">
<li><a href="index.php">Home</a></li>
<li><a href="about-us.php">About Us</a></li>
<li><a href="#">Products</a>
<ul class="submenu pop">
<?php
$result = mysqli_query ($con,"SELECT CategoryId,CategoryName FROM category ORDER BY    CategoryId ASC");
while ($row=mysqli_fetch_array($result)){
 ?>
<!-- check edit in line Below -->
<li><a href='<?php echo trim($row['CategoryName']).'php'; ?>'><?php echo $row['CategoryName'];?></a></li>
 <?php } ?>
 </ul>
 </li>
 <li><a href="construction.php">Directors</a></li>
 <li><a href="contact-us.php">Contact Us</a></li>
</ul>
于 2013-06-24T07:24:33.520 回答