int 때문인 것 같은데, 문자를 저장하려면 어떻게해야 될까요?

int 때문인 것 같은데, 문자를 저장하려면 어떻게해야 될까요?

QA

int 때문인 것 같은데, 문자를 저장하려면 어떻게해야 될까요?

답변 2

본문

orderformcartupdate.php 에서 수량을 변경하는 부분입니다.

문자를 넣고 싶은데 숫자만 저장이 됩니다.

int 때문인 것 같은데, 문자를 저장하려면 어떻게해야 되나요?

도움 부탁 드립니다. ㅜㅜ

 

    // 수량이 변경됐다면
    $ct_qty = isset($_POST['ct_qty'][$k]) ? (int) $_POST['ct_qty'][$k] : 0;
    if($ct['ct_qty'] != $ct_qty) {
        $diff_qty = $ct['ct_qty'] - $ct_qty;

        // 수량변경
        $sql = " update {$g5['g5_shop_cart_table']}
                    set ct_qty = '$ct_qty'
                    where ct_id = '$ct_id'
                      and od_id = '$od_id' ";
        sql_query($sql);
        $mod_history .= G5_TIME_YMDHIS.' '.$ct['ct_option'].' 수량변경 '.$ct['ct_qty'].' -> '.$ct_qty."\n";
    }

이 질문에 댓글 쓰기 :

답변 2

    $ct_com = isset($_POST['ct_com'][$k]) ? (string) $_POST['ct_com'][$k] : '';

 

 

이게 될진 모르겠네요. ct_com 포스트 변수가 배열 맞나요?

근데 문자를 어느곳에 넣고 싶단건가요? 결과물 어떻게 되나요?

답변 감사드립니다.

g5_shop_cart 테이블에 ct_com이란 필드를 text 타입으로 추가하여 저장하려고 해요.

    $ct_com = isset($_POST['ct_com'][$k]) ? (int) $_POST['ct_com'][$k] : 0;
    if($ct['ct_com'] != $ct_com) {
        $diff_qty = $ct['ct_com'] - $ct_com;


        $sql = " update {$g5['g5_shop_cart_table']}
                    set ct_com = '$ct_com'
                    where ct_id = '$ct_id'
                      and od_id = '$od_id' ";
        sql_query($sql);
        $mod_history .= G5_TIME_YMDHIS.' '.$ct['ct_option'].' 회사명변경 '.$ct['ct_com'].' -> '.$ct_com."\n";
    }

답변을 작성하시기 전에 로그인 해주세요.
QA 내용 검색
질문등록
전체 150
© SIRSOFT
현재 페이지 제일 처음으로