gpt4 book ai didi

php - mysql简单查询+if

转载 作者:行者123 更新时间:2023-11-29 20:17:20 25 4
gpt4 key购买 nike

似乎我无法进行简单的查询。

我想要实现的是“best2”值为“1”的所有结果,因此 div 将仅附加到这些结果。

现在,div“badge-best2div”附加到所有产品。

我不知道我错过了什么。

<?php $show = true; ?>
<?php

$roman = Doctrine_Query::create()->from("Product")
->where("status = 1")
->andWhere("site_id = ? ", SITE_ID)
->andWhere("best2 = 1")
->fetchOne(array(), Doctrine_Core::HYDRATE_ARRAY);

?>
<?php if ($product->getIsTop() && !isset($hide_badge_top)): $show = false;?>
<div class="badge-top"></div>
<?php endif; ?>
<?php if ($roman['best2']){
$show = false; ?>
<div class="badge-best2div"></div>
<?php } ?>

<?php if ($product->getIsBestBuy() && !isset($hide_badge_bestbuy) && $show): ?>
<div class="badge-bestbuy"></div>
<?php endif ; ?>

最佳答案

使用它来工作

<?php if (($roman['best2'])==1){ 

关于php - mysql简单查询+if,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39663202/

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