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

장바구니 기능 질문드립니다. 채택완료

다나한포션 3년 전 조회 1,882

안녕하세요.

예전에 영카트 장바구니 기능을 그누보드에 이식하여 사용을 하였는데요

게시물에서 장바구니 버튼을 누른 후 장바구니에 넣어 놓고 보면

내가 장바구니에 넣어놓은 내용이 아닌

다른 사람이 넣어놓은 내용까지 전부 보여집니다.

 

로그인은 하지 않고 비회원이 주로 사용합니다.

아래는 장바구니 확인 화면 소스 입니다.

 

</p>

<p><?php

error_reporting ( E_ALL );

ini_set ( "display_errors", 0 );

define('_CART_', true);

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

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

if($wr_id && $bo_table){

    $query="insert into yc4_cart set on_uid='$_SESSION[on_uid]', wr_id='$wr_id', ct_status='', ct_qty='1', ct_time=now(), ct_ip='$_SERVER[SERVER_ADDR]',bo_table='$bo_table'";

    $result = sql_query($query);

}

?></p>

<p>

<div id="cart_">

    <form name="form1" method="post" action="cart2.php"></p>

<p>    <table cellspacing="0" border="1">

        <caption>table</caption>

        <colgroup>

        <col width="5%" class="mrs"><col width="15%"><col width="25%"><col width="25%"><col width="20%"><col width="15%">

        </colgroup></p>

<p>        <thead>

            <tr>

                <th scope="col" class="mrs">번호</th>

                <th scope="col">제품이미지</th>

                <th scope="col">물품명</th>

                <th scope="col">제품사양</th>

                <th scope="col">수량</th>

                <th scope="col">관리</th>

            </tr>

        </thead> </p>

<p>        <tbody> 

                

        <?

            $query="select * from yc4_cart where on_uid='$_SESSION[on_uid]' order by ct_id";

            $cart_result=sql_query($query);

            if(!$cart_result) echo mysql_error();

            $i=0;

            while($cart=sql_fetch_array($cart_result)){

                $query="select * from g5_write_".$cart[bo_table]." where wr_id='$cart[wr_id]'";

                $it_result=sql_query($query);

                $it=sql_fetch_array($it_result,MYSQL_ASSOC);

                

                $query="select * from g5_board_file where bo_table='$cart[bo_table]' and wr_id='$cart[wr_id]'";

                $file_result=sql_query($query);

                $file_rows=sql_fetch_array($file_result,MYSQL_ASSOC);

        ?>

        

        <input type=hidden name="ct_id[<?php echo $i;?>]" value="<?=$cart[ct_id]?>" target="hiddenframe"></p>

<p>            <tr>

                <td class="mrs"><?=($i+1)?></td>

                <td><?if($file_rows[bf_file]){?><img src="/data/file/<?=$cart[bo_table]?>/<?=$file_rows[bf_file]?>"><?}else{?><?}?></td>

                <td><?=$it[wr_subject]?></td>

                <td>

                    <select id="cc_6[<?php echo $i;?>]" name="cc_6[<?php echo $i;?>]" style="width:80%">

                    <option value="" selected>선택하세요</option>

                    <?php 

                    for($a=1; $a<11; $a++) { 

                    if($it['wr_'.$a]) { 

                    echo "<option value='".$it['wr_'.$a]."'>".$it['wr_'.$a]."</option>"; 

                    } 

                    } 

                    ?> 

                </td>

                <td><input type="text" name="ct_qty[<?php echo $i;?>]" value="<?=$cart[ct_qty]?>" style="text-align:center"><a href="javascript:cartupdate(<?=$i?>)" class="cart_btn01">수정</a> </td>

                <td><a href="cart_delete.php?ct_id=<?=$cart[ct_id]?>" class="cart_btn02">삭제</a></td>

            </tr>

            <? $i++;    }?></p>

<p>        </tbody> 

    </table>

    

    <input type="hidden" name="product_count" value="<?php echo $i;?>">

    </form></p>

<p>

            <script>

            function cartupdate(no){

                f=document.form1;

                f.action="cart_update.php?no="+no;

                f.submit();

            }</p>

<p>            function submitCart(){

                f=document.form1;

                f.action="cart2.php";

                

                for(i=0;i<f.product_count.value;i++){

                    var e = f['cc_6['+i+']'];

                    console.log(e);</p>

<p>                }</p>

<p>                f.submit();

            }

            </script>

            </p>

<p>

</div>

<?php

include_once(G5_THEME_PATH.'/tail.php');

?></p>

<p>

 

섹션부분이 잘못된거 같은데

고수님들 도움 부탁드립니다. ㅠ

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

답변 2개

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

on_uid는 영카트에서 따로 생성을 할텐데 해당도 가지고 오셨나요?

넣는 쿼리문에서 해당 값이 제대로 들어가고 있나 확인을 해보셔야 할거 같습니다.

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

답변에 대한 댓글 1개

다나한포션
3년 전
네 생성을 db에 해놨고
값도 잘 들어오고있습니다.
근데 내 장바구니 내용이 다른사람한테 보이는게 문제이네요 ㅠ
첨부파일로 db구조 올려놓았습니다.

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

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

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

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

로그인