특정 상품의 주문 건수 개수를 불러와 뿌려주려고 하는데, 아래를 어떻게 변경하면 될까요?
Copy
<?php
$sql = " SELECT COUNT(IF($it[it_id], it_id, NULL)) FROM `g5_shop_cart` WHERE 1";
$result = sql_query($sql);
$output = mysql_num_rows($result);
echo $output ?>
|
답변 2개
채택된 답변
+20 포인트
2018-11-21 (수) 22:29:11
$sql = "select count(*) as cnt from g5_shop_cart where it_id = '{$it[it_id]}'";
$res = sql_fetch($sql);
echo $res[cnt];
2018-11-21 (수) 22:52:39
$row = sql_fetch("select count(*) as cnt from g5_shop_cart where it_id = '$it_id' and ct_status<>'취소' and ct_status<>'쇼핑' and ct_status<>'삭제' ");
echo $row['cnt'];
답변을 작성하려면 로그인이 필요합니다.