解析错误:语法错误,意外' endwhile' (T_ENDWHILE),预计第26行的D:\ xampp \ htdocs \ thelewala \ includes \ navigation.php中的文件结尾
这是代码
<?php
$sql = "SELECT * FROM categories WHERE parent = 0";
$pquery = $db->query($sql);
?>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark fixed-top">
<!-- Brand -->
<a class="navbar-brand" href="#">THELEWALAONLINE</a>
<!-- Links -->
<ul class="navbar-nav">
<?php while($parent = mysqli_fatch_assoc($pquery)) ; ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-toggle="dropdown">Shop</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Men's</a>
<a class="dropdown-item" href="#">Sport's</a>
<a class="dropdown-item" href="#">Women's</a>
<a class="dropdown-item" href="#">Kid's</a>
</div>
</li>
<?php endwhile; ?>
</ul>
</nav>
答案 0 :(得分:0)
<?php while($parent = mysqli_fatch_assoc($pquery)) : ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbardrop" data-
toggle="dropdown">Shop</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="#">Men's</a>
<a class="dropdown-item" href="#">Sport's</a>
<a class="dropdown-item" href="#">Women's</a>
<a class="dropdown-item" href="#">Kid's</a>
</div>
</li>
<?php endwhile; ?>
</ul>
</nav>
在while循环语句中将;
更改为: