我只知道这部分代码对性能Web应用程序不利,因为它在执行过程中花费了很多时间使用两个SQL查询而不是一个SQL查询。我想阅读您对这部分代码的建议。另外,我想阅读您的代码解决方案。该代码工作正常。我感谢您的帮助。先感谢您<html><body> <select name="category"> <option value="category">category name</option> <?php $sql = "SELECT category.name as cat, article.name as art from category JOIN article ON category.id = article.id"; $query = mysqli_query($conn, $sql); while($row = mysqli_fetch_array($query)){ echo " <option value='".$row["cat"]."'>".$row["cat"]."</option>"; } mysqli_close($conn); ?> </select> <select name="article"> <option value="articlename">article name</option> <?php $sql = "SELECT category.name as cat, article.name as art from category JOIN article ON category.id = article.id"; $query = mysqli_query($conn, $sql); while($row = mysqli_fetch_array($query)){ echo " <option value='".$row["art"]."'>".$row["art"]."</option>"; } mysqli_close($conn); ?> </select></body></html>
2 回答
- 2 回答
- 0 关注
- 128 浏览
添加回答
举报
0/150
提交
取消