gpt4 book ai didi

php - 如何显示类别的项目?

转载 作者:行者123 更新时间:2023-11-30 22:01:18 25 4
gpt4 key购买 nike

我需要显示我拥有的每个类别的项目。我使用 smarty 模板。所以我得到这样的类别:

{foreach $news as $article}
<div class="panel panel-info">
<div class="panel-heading">{$article["name"]}</div>
<div class="panel-body">
"Here I need to display Items that have FOREIGN KEY 'category_id'"
</div>
</div>
{/foreach}

我是否应该获取类别的 ID 以及如何显示它? It's a category list with ID

我想改进我的问题 - 这里有一些指向我的 Controller 的链接.我试过添加更多链接,但万一声望不高我做不到。请尝试看看我做错了什么?

最佳答案

<?php
$lists = '';
$query = "your query example" - mysqli_query($conn,"select * from article");
if(!$mysqli_num_rows<0){
while($row = mysqli_fetch_array($query,MYSQLI_ASSOC)){
$id = $row["category_id"];
$name = $row["name"];

$lists .= '<div class="panel panel-info">
<div class="panel-heading">'.$name.'</div>
<div class="panel-body">
"Here I need to display Items that have FOREIGN KEY '.$id.'"
</div>
</div>';
}

echo $lists;
}


?>

关于php - 如何显示类别的项目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43249861/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com