채택완료

영카트 할인율 문의 할인율 :    xxxx %  어떻게 표기 해야 할까요?

영카트 메인에 아래와 같이 해서 제품을 메인에 출력하고있습니다 

아래 소스         할인율 :    xxxx %  부분에 할일율을 어떻게 표기해야 할까요? 

 

Copy
<ul class="itemlist2">
        <?php
            $sql="select * from g5_shop_item where ca_id like '70%' and it_type4=1 limit 0,4";
            $result=sql_query($sql);
            while($row=sql_fetch_array($result)){
                $img = get_it_image1($row['it_id'], 500, 500, '', '', stripslashes($row['it_name']));
        ?>
            <li>
                <a href="/shop/item.php?it_id=<?=$row['it_id']?>"></a>
                <div class="tmb" style="background-image: url('<?=$img?>');"></div>
                <div class="inf">

                  할인율 :    xxxx % 
                  <span class="cat"><?=$row['it_basic']?></span>
                    <span class="tit"><?=$row['it_name']?></span>
                </div>
            <?php
                if($member['mb_no']){
            ?>
                <div class="price">
                    <em><?=display_price($row['it_cust_price'])?></em>
                    <strong><? echo display_price(get_price($row), $row['it_tel_inq'])?></strong>
                </div>
            <?php
                }else{
            ?>
                <div class="price">
                    <strong style="text-decoration: line-through;"><?=display_price($row['it_cust_price'])?></strong>
                </div>
            <?php
                }
            ?>
            </li>
        <?php
            }
        ?>
        </ul>
|

답변 1개

채택된 답변
+20 포인트

할인율 은 아래처럼 구하시면 됩니다.

Copy
echo (100-ceil(($row['it_price']/$row['it_cust_price'])*100));

답변을 작성하려면 로그인이 필요합니다.