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

login_chack.skin 채택완료

망공 2년 전 조회 1,851

로그인을할때 현제까지 누적금액을 계산해서 등급을 자동으로 높히려고하는대요..

</strong></p>

<p>if($mb_level['mb_level'] < 10){</p>

<p>            $sql = "select sum(a.od_cart_price) od_cart_price from {$g5['g5_shop_order_table']} a inner join {$g5['member_table']} b on a.mb_id = b.mb_id where a.od_status = '완료' and a.mb_id = '{$member['mb_id']}'"; // 주문상태 취소를 제외,</p>

<p>        $row = sql_fetch($sql);</p>

<p>        $cart_price = $row['od_cart_price'];</p>

<p>        if($cart_price >= 300000){</p>

<p>            $level_up = 3;</p>

<p>        }</p>

<p>        $sql= " update {$g5['member_table']} set mb_level = '$level_up' where mb_id = '$mb_id' ";</p>

<p>        sql_query($sql);</p>

<p>    }</p>

<p><strong>

이상하게 첫 if문만 통과하고 중간에있는 if문은 그냥 넘어가버립니다 누적금액을 변수로 받아봐도 안돼는데.. 이거 왜이러는건가요 ..?

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

답변 2개

채택된 답변
+20 포인트

직접코드를 실행해보지 않아 우선 확인하실께 

</strong></p>

<p>var_dump(<code>$cart_price</code>);</p>

<p><strong>
 

</strong>
<code>if($mb_level['mb_level'] < 10){
 $sql = "select sum(a.od_cart_price) od_cart_price from {$g5['g5_shop_order_table']} a inner join {$g5['member_table']} b on a.mb_id = b.mb_id where a.od_status = '완료' and a.mb_id = '{$member['mb_id']}'"; // 주문상태 취소를 제외, $row = sql_fetch($sql); $cart_price = $row['od_cart_price'];</code></pre>

<p>var_dump(<code>$cart_price</code>);</p>

<pre>
<code> if($cart_price >= 300000){ $level_up = 3; } $sql= " update {$g5['member_table']} set mb_level = '$level_up' where mb_id = '$mb_id' "; sql_query($sql); 
}</code>
<strong>

 

출력이 되는지 확인해보시고 다음단계로 진행해야 할것 같아요

 

--------------------------------------------------------------------------------------------------------------------

 

더 자세한 내용이 궁금하시면 여기 방문하세요

같이 얘기나누며 문제해결에 도움이 되도록 하세요

 

https://open.kakao.com/o/gzNuQjhe" rel="nofollow noreferrer noopener" target="_blank">https://open.kakao.com/o/gzNuQjhe

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

답변에 대한 댓글 1개

망공
2년 전
감사합니다 ㅠㅠ

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

s
sinbi Expert
2년 전

뭐가 안 될 땐, 소스를 구성하는 각각의 변수부터 값이 제대로 찍히는지 점검해 보셔야...

  • var_dump(변수) 
  • print_r(변수)
  • print_r2(변수)
로그인 후 평가할 수 있습니다

답변에 대한 댓글 2개

웹랭귀지
2년 전
ㅋ 맞아요 그걸 디버깅이라고 하죠
망공
2년 전
죄송합니다 ㅠㅠ 제가아직 실력이 모잘라서.. 계속 해보면서 변수가 안찍히는걸 알았습니다.. ㅠㅠ

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

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

로그인