db를 불러올때말이지요..

<?
    $qry = "SELECT op_pcode,sum(op_cnt) as cnt
            FROM view_order where paystatus = 'Y'
            and canceled = 'N'
            and ifnull(isNow,'N') = 'Y'
            group by op_pcode
            order by cnt desc limit 10";
 

    $rlt = mysql_query($qry);
    while($row = mysql_fetch_array($rlt)) {
        $pcode = $row['op_pcode']; 
        $pcnt = $row['cnt']; 
        //상품명
        $prslt =  mysql_fetch_array(mysql_query("select name,cateCode,price_org,price,saleCnt from odtProduct where code='".$pcode."'"));
        $pname = $prslt[name];
        $price_org = $prslt[price_org];
        $price = $prslt[price];
        $pcatecode = $prslt[cateCode];
  $psalecnt = $prslt[saleCnt];
        //카레고리명
        $pcatename =  mysql_result(mysql_query("select catename from odtCategory where catecode='".$pcatecode."'"),0);
?>
 
 
이것들이 다 무슨 말이지요?? 저는 디비 안에 있는   [saleCnt] 라는 디비값만 가져오고 싶은데...
 
저 위의 구문이 해석이 안되니 힘드네요 ..
 
빨간색 구문은 특히 이해가 안갑니다 무슨 설정 값인지..
 
아래부분은 대충 이해는 했습니다만 ㅠㅠ
 
 
해석해주실 능력자분 계신가요?
|

댓글 3개

자유게시판에서 게시물 이동됩니다.
SELECT 검색해라
op_pcode,sum(op_cnt) as cnt 를
FROM view_order 이테이블에서
where paystatus = 'Y'
            and canceled = 'N'
            and ifnull(isNow,'N') = 'Y'
조건은 지불상태가y이면서 취소하지 않은것을 그리고 isnow 상태가 비어있다면 n으로 바꿔라 그 isnow 가 y 인조건으로

            group by op_pcode
그결과를 op_pcode 로 묵어라

order by cnt desc
소팅하라 cnt가 높은순으로
limit 10
그중 10개만 출력하라 정도 되겠습니다
정말 감사합니다!!! 많은 도움이 되었어요!! ㅠㅠ

댓글 작성

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

로그인하기
🐛 버그신고