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

장바구니를 활용한 견적서 출력에서 lib파일 오류? 채택완료

qoqofh 4년 전 조회 1,830

Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in /www_root/lib/common.lib.php on line 1692

 

이에러는 어떻게 해결해야할까요....? 

 

장바구니에서 견적서를 출력하는 구문을 제작하려하는데,

 

</p>

<p><?php

include_once('./_common.php');</p>

<p>include_once(G5_PATH.'/head.sub.php');</p>

<p>

//print_r($_GET);

print_r($_POST);

print_r($_res);</p>

<p># 세션데이터에서 장바구니 전송값을 가져온다. ---------------------------------------------------

# [cart.php -> ajax.cartprint.php 세션저장한 값]

$tmp_data = get_session("cartprint");

if($tmp_data) {

    $array = unserialize($tmp_data);

}

//print_r($array);</p>

<p># 장바구니 데이터 검사 --------------------------------------------------------------------------

if(is_array($array) && is_array($array['it_id']) && is_array($array['ct_chk'])) {

    # 장바구니 전송됨

} else {

    # 장바구니 전송안됨

    echo "<h2>견적서를 출력할 제품이 없습니다.</h2>";

    include_once(G5_PATH.'/tail.sub.php');

    exit;

}</p>

<p>

# 장바구니 no 가공 ---------------------------------------------------------------------------</p>

<p>/* 장바구니 상품번호와 체크여부(ct_chk)를 비교하여 견적할 제품번호만 남긴다. */</p>

<p>    foreach($array['it_id'] as $key=>$val) {

    if(isset($array['ct_chk'][$key]) && $array['ct_chk'][$key]=="1") {

        $TMP['it'][] = $val;

    } else {

        continue;

    }

}</p>

<p>//print_r($TMP['it']);</p>

<p>if(is_array($TMP['it']) && is_array($TMP['it'])) {

    # 견적할 제품이 있음

} else {

    # 견적할 제품이 없음

    echo "<h2>견적서를 출력할 제품이 없습니다.</h2>";

    include_once(G5_PATH.'/tail.sub.php');

    exit;

}</p>

<p>

# 장바구니 DB 가져오기 ---------------------------------------------------------------------------</p>

<p>$s_cart_id = get_session('ss_cart_id');</p>

<p>// $s_cart_id 로 현재 장바구니 자료 쿼리

$qry = " SELECT * FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$s_cart_id' AND it_id IN ( ". implode(",", $TMP['it']) ." ) ORDER BY it_id ";</p>

<p>$res = sql_query($qry);

if(sql_num_rows($res)>0) {

    $idx = 0;

    while($row = sql_fetch_array($res)) {

        $DATA['cart'][$idx] = $row;</p>

<p>        # 옵션DB 가져오기

        $qry2 = " SELECT * FROM {$g5['g5_shop_item_option_table']} WHERE it_id = '{$row['it_id']}' AND io_id='{$row['io_id']}' AND io_type='0' ";

        $res2 = sql_query($qry2);

        if(sql_num_rows($res2)>0) {

            $DATA['opt'][$idx] = sql_fetch_array($res2);

        }</p>

<p>        $idx++;

    }

}</p>

<p>//print_r($DATA);</p>

<p>

# 출력화면 그리기      ---------------------------------------------------------------------------</p>

<p>?></p>

<p>

<style type="text/css">

.print-wrap { width:600px; box-sizing:border-box; margin:5px auto; }

/* 표제부 */

.table-info { border-collapse:collapse; width:100%; }

.table-info * { font-size: 12px;}

.table-info td { border:1px solid #09a4b6; height:20px; }

.table-info .td-row-6 { background:#06899f; color:#ffffff; text-align:center; }

.table-info .td-head { background:#67b9c2; text-align:center; color:#ffffff; }

/* 제품리스트 */

.table-list { border-collapse:collapse; width:100%; margin:20px 0 0 0; }

.table-list * { font-size:12px;}

.table-list td { border:1px solid #09a4b6; height:20px; }

.table-list .td-head { background:#67b9c2; text-align:center; color:#ffffff; }

.table-list .td-body { font-size:11px !important; }

/* 공통 */

.input-1 { width:174px; }

.td-right { text-align:right; }

.td-center { text-align:center; }

/* 기타 */

.div-help { margin:10px 0; color:#2861c8; }

.print-button { width:600px; margin:10px auto; text-align:right; }

.print-button button { padding:4px 10px; background:#2548a5; color:#ffffff; border:0; }

@media print {

    .print-button { display:none; }

}

</style></p>

<p><div class="print-wrap"></p>

<p>    <table class="table-info">

    <col width="20">

    <col width="60">

    <col width="180">

    <col width="20">

    <col width="60">

    <col width="">

    <col width="60">

    <col width="">

    <tr>

        <td class="td-row-6" rowspan="6">의
뢰
자</td>

        <td class="td-head">견적일</td>

        <td class="td-body"><input type="text" class="input-1" value="<?=date("Y-m-d")?>"></td>

        <td class="td-row-6" rowspan="6">공
급
자</td>

        <td class="td-head">등록번호</td>

        <td class="td-body" colspan="3"><?=$default['de_admin_company_saupja_no']?></td>

    </tr>

    <tr>

        <td class="td-head">업체명</td>

        <td class="td-body"><input type="text" class="input-1"></td>

        <td class="td-head">회사명</td>

        <td class="td-body"><?=$default['de_admin_company_name']?></td>

        <td class="td-head">성명</td>

        <td class="td-body"><?=$default['de_admin_company_owner']?></td>

    </tr>

    <tr>

        <td class="td-head">담당자</td>

        <td class="td-body"><input type="text" class="input-1"></td>

        <td class="td-head">주소</td>

        <td class="td-body" colspan="3"><?=$default['de_admin_company_addr']?></td>

    </tr>

    <tr>

        <td class="td-head">전화</td>

        <td class="td-body"><input type="text" class="input-1"></td>

        <td class="td-head">업태</td>

        <td class="td-body"><?=$default['de_biztype_a']?></td>

        <td class="td-head">종목</td>

        <td class="td-body"><?=$default['de_biztype_b']?></td>

    </tr>

    <tr>

        <td class="td-head">팩스</td>

        <td class="td-body"><input type="text" class="input-1"></td>

        <td class="td-head">전화</td>

        <td class="td-body"><?=$default['de_admin_company_tel']?></td>

        <td class="td-head">팩스</td>

        <td class="td-body"><?=$default['de_admin_company_fax']?></td>

    </tr>

    <tr>

        <td class="td-head">E-mail</td>

        <td class="td-body"><input type="text" class="input-1"></td>

        <td class="td-head">담당자</td>

        <td class="td-body" colspan="3"></td>

    </tr>

    </table></p>

<p>    <table class="table-list">

    <col width="80">

    <col width="80">

    <col width="80">

    <col width="">

    <col width="60">

    <col width="40">

    <col width="70">

    <tr>

        <td class="td-head">제품번호</td>

        <td class="td-head">제품명</td>

        <td class="td-head">형식번호</td>

        <td class="td-head">제품사양</td>

        <td class="td-head">단가</td>

        <td class="td-head">수량</td>

        <td class="td-head">가격</td>

    </tr></p>

<p>    <?

    $total_price = 0;

    $this_price = 0;

                                   

   if (isset($DATA['cart']) && is_array($DATA['cart'])) {                                

    foreach($DATA['cart'] as $key=>$val) {

        $this_price = ($val['ct_price']+$val['io_price']) * $val['ct_qty'];

        $total_price += $this_price;

        

    ?>

    <tr>

        <td class="td-body"><?php $val['io_id']?></td>

        <td class="td-body"><?php $val['it_name']?></td>

        <td class="td-body"><?php $DATA['opt'][$key]['io_misc01']?></td>

        <td class="td-body"><?php $DATA['opt'][$key]['io_misc02']?></td>

        <td class="td-body td-right"><?=number_format($val['ct_price']+$val['io_price'])?></td>

        <td class="td-body td-center"><?=number_format($val['ct_qty'])?></td>

        <td class="td-body td-right"><?=number_format($this_price)?></td>

    </tr>

    

    

    <?

    } # end of if 

       } # end foreach;

    ?></p>

<p>    <tr>

        <td class="td-body td-center" colspan="6"><strong>합계금액</strong></td>

        <td class="td-body td-right"><strong><?=number_format($total_price)?></strong></td>

    </tr></p>

<p>

    </table></p>

<p>    <div class="div-help">

        상기 견적내용은 환율에 따라 가격이 변동될 수 있으니 참고용으로만 활용하시기 바랍니다.


        (견적내용 및 입력사항은 서버로 전송되지 않습니다)


        자세한 견적상담을 원하시면 <?=$default['de_admin_company_tel']?>로 전화바랍니다.

    </div></p>

<p></div></p>

<p><div class="print-button">

    <button type="button" onClick="print();">인쇄</button>

    <button type="button" onClick="window.close();">닫기</button>

</div></p>

<p><?</p>

<p>include_once(G5_PATH.'/tail.sub.php');

?></p>

<p>

 

여기서 에러가 나오고 있습닏 ㅏㅠ

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

답변 1개

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

$qry = " SELECT * FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$s_cart_id' AND it_id IN ( ". implode(",", $TMP['it']) ." ) ORDER BY it_id ";

위 쿼리를 실행하면 에러가 나기 때문에..

 

다음 코드

$res = sql_query($qry);
if(sql_num_rows($res)>0) {

에서 레코드 갯수를 가져오는 부분에서도 에러가 난 것입니다.

 

$qry = " SELECT * FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$s_cart_id' AND it_id IN ( ". implode(",", $TMP['it']) ." ) ORDER BY it_id ";

->

$qry = " SELECT * FROM {$g5['g5_shop_cart_table']} WHERE od_id = '$s_cart_id' AND it_id IN ( '". implode("','", $TMP['it']) ."' ) ORDER BY it_id ";

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

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

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

로그인