테스트 사이트 - 개발 중인 베타 버전입니다

mysql 카운트 질문드립니다. 채택완료

무지 9년 전 조회 2,547

 

    $sql = " select *

               from {$g5['g5_shop_order_table']}

              where mb_id = '{$member['mb_id']}'

              order by od_id desc

              $limit ";

    $result = sql_query($sql);

$oder = "SELECT COUNT(*)FROM{$g5['g5_shop_order_table']} WHERE od_status ='주문'";

$bder = "SELECT COUNT(*) FROM{$g5['g5_shop_order_table']} WHERE od_status ='입금'";

?>

 

로 했을때 카운트가 1로만 표시되네요 od_status 주문,입금,준비,배송,완료 를 카운팅하고싶은데 생각처럼 잘안되네요 도움좀 주실분계신가요 3개월동안 못풀고있어요 주륵

관련게시물:http://sir.kr/qa/109344">http://sir.kr/qa/109344

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

답변 1개

채택된 답변
+20 포인트
SLOOP
9년 전

</p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>$oder = "SELECT COUNT(*) cnt FROM{$g5['g5_shop_order_table']} WHERE od_status ='주문'";</p><p style="word-break: break-all;"><font color="#484848" face="돋움, Dotum, sans-serif"><span style="font-size: 14.004px; line-height: 25.2072px;"> $result_order = sql_fetch($</span></font><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;">oder </span><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;">);</span><font color="#484848" face="돋움, Dotum, sans-serif"><span style="font-size: 14.004px; line-height: 25.2072px;"> </span></font></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"><span class="Apple-tab-span" style="white-space: pre;">	</span>$bder = "SELECT COUNT(*) cnt FROM{$g5['g5_shop_order_table']} WHERE od_status ='입금'";</p><p style="word-break: break-all;"><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"> $result_</span><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;">bder</span><font color="#484848" face="돋움, Dotum, sans-serif"><span style="font-size: 14.004px; line-height: 25.2072px;"> = sql_fetch($</span></font><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;">bder </span><span style="color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;">);</span><font color="#484848" face="돋움, Dotum, sans-serif"><span style="font-size: 14.004px; line-height: 25.2072px;"> </span></font></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"><span style="font-size: 14.004px; line-height: 25.2072px;"> </span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"><span style="font-size: 14.004px; line-height: 25.2072px;">echo $</span><span style="font-size: 14.004px; line-height: 25.2072px;">result_order['cnt'];</span></p><p style="word-break: break-all; color: rgb(72, 72, 72); font-family: 돋움, Dotum, sans-serif; font-size: 14.004px; line-height: 25.2072px;"><span style="font-size: 14.004px; line-height: 25.2072px;">echo $</span><span style="font-size: 14.004px; line-height: 25.2072px;">result_</span><span style="font-size: 14.004px; line-height: 25.2072px;">bder</span><span style="font-size: 14.004px; line-height: 25.2072px;">['cnt'];</span><span style="font-size: 14.004px; line-height: 25.2072px;"> </span></p><p>

로그인 후 평가할 수 있습니다

답변에 대한 댓글 1개

무지
9년 전
답변 감사드립니다 ^^
근데 echo 했을때 아무반응이 없어요... 뭐가 잘못된걸까요
구문상 $sql이랑 $result는 날려버려도 괜찮은거죠?
그리고 WHERE od_status ='주문' 이 정확하지 않은건지도
조금더 가르쳐 주실수있으신가요...

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

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

로그인