다시한번 문의드립니다. 지정한위치에서부터 다시 읽게하는 함수

다시한번 문의드립니다. 지정한위치에서부터 다시 읽게하는 함수

QA

다시한번 문의드립니다. 지정한위치에서부터 다시 읽게하는 함수

본문

 
해당변수에 적용되어 변수안에잇는 쿼리를 읽은경우
지정한곳에서부터 다시 읽게 하는 함수가 잇는지요?

이 질문에 댓글 쓰기 :

답변 6

제가 기획의도는 알지 못하지만
goto 문이 나오는건  로직이 최적화 되지 않았다는 것을 의미하므로
로직을  다시 검토해보시기 바랍니다..

if ($is_member)
        경고창;

while(1){  //반복문을 만든다...........

if (레벨6이하) {
      메롱
      continue; 반복문을 다시 돌린다.
}else{
      까꿍
}

break; //나간다......
}  //while

라엘님의 답변을 받앗습니다..........이렇게 해석하면되나요?

무슨 뜻이죠?
해당변수에 적용되어 있는 쿼리가......

뭔지 모르지만
그런것 없어요

링크건 질문에 적은 소스에 빨간부분이 적용되면 파란색에 표시한 위치에서부터 다시 리턴해서 로드시키는 함수라던가
아니면 빨간부분이 적용되면 해당 페이지가 종료되고 다시 해당페이지가 처음부터 로드시키는거라든지요.....
아 설명이 넘 어렵나요 ㅡㅜ

아 너무 쉽게 생각햇나보군요.......
조건변수에 적용되어 빨간부분을 로드하게되면
바로 밑에 리턴함수를 넣어서 파란부분부터 다시 로드시키는 함수가 있다고 믿엇는데
그런게 없다니 ;;;;;;
그럼 해당 조건변수에 적용되어 빨간부분이 로드되면
처음부터 다시 로드하거나 파란부분부터 로드시킬 방법은 아예없는건가요?
 
<?
include_once("_common.php");
if (!$member[mb_id])
    alert_close("잘못된 접근입니다.");
if (!($write[mb_id] == $member[mb_id] || $mb_id == $member[mb_id]))
     alert_close("잘못된 접근입니다.");
if (!($bo_table && $wr_id && $mb_id && $sc_no))
    die("값이 제대로 넘어오지 않았습니다.");
$sco = sql_fetch(" select * from g4_sc_order where sc_id = '$wr_id' and or_st = '1' and sc_no = '$sc_no' and mb_id = '$mb_id' ");
if (!$sco)
    alert_close("주문정보가 없습니다.");
 $sc = sql_fetch(" select * from g4_sc where sc_id = '$wr_id' and sc_no = '$sc_no' ");
if (!$sc)
    alert_close("특가정보가 없습니다.");
 
이부분부터 다시 시작
 
//첫번째 대기자 정보 뽑음
$scover = sql_fetch("select * from g4_sc_order where sc_id = '$wr_id' and or_st = '0' and sc_no = '$sc_no' order by or_datetime limit 0,1");
 
if ($scover) { //###########대기자가 있다면
         if ($sco[or_cnt]<$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@@@@주문자보다 대기자의 수량이 더 많다면
   $point_save =  $write[wr_7]*$sco[or_cnt]; //-------수량에 따른 포인트값 계산
         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");

           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }

         $mocnt = $scover[or_cnt] - $sco[or_cnt]; //대기자의 수량에서 취소자의 수량뺌
   $moprice = $scover[or_price] - $sco[or_price]; //대기자의 금액에서 취소자의 금액뺌
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1', or_cnt = '{$sco[or_cnt]}', or_price = '{$sco[or_price]}' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
         //남는수량만큼 대기자정보 새로추가
   $sql = " insert into g4_sc_order
              set sc_id = '$wr_id',
                    sc_product = '{$scover[sc_product]}',
                    sc_name = '{$scover[sc_name]}',
                    sc_no = '{$scover[sc_no]}',
                    mb_id = '$mb_id',
                    or_cnt = '{$mocnt}',
                    or_price = '{$moprice}',
                    or_name = '{$scover[or_name]}',
                    or_bank = '{$scover[or_bank]}',
                    or_tel = '{$scover[or_tel]}',
                    or_addr = '{$scover[or_addr]}',
                    or_ip = '{$scover[or_ip]}',
                    or_memo = '{$scover[or_memo]}',
                    or_datetime = '{$scover[or_datetime]}',
                    or_st = '0' ";
        sql_query($sql);
        
   }else if ($sco[or_cnt]>$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@주문자보다 대기자의 수량이 적다면
                                   $point_save =  $write[wr_7]*$scover[or_cnt]; //-------수량에 따른 포인트값 계산
                                         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");

           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }
   $modcnt = $sco[or_cnt] - $scover[or_cnt]; //취소자의 수량에서 대기자의 수량뺌
   $modprice = $sco[or_price] - $scover[or_price]; //취소자의 금액에서 대기자의 금액뺌
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
   // 취소자정보 업데이트
         mysql_query(" update g4_sc_order set or_cnt = '$modcnt', or_price = '$modprice' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '$mb_id' and or_st = '1' ");
 
 
        }else if ($sco[or_cnt]==$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@주문자 대기자 수량이 같다면

                                        $point_save =  $write[wr_7]*$scover[or_cnt]; //-------수량에 따른 포인트값 계산
                                         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");

           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
   // 취소자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '0', or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '$mb_id' and or_st = '1' ");

  } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@수량비교끝
}else{ //###############대기자가 없다면
// 상품수량증가 업데이트
mysql_query(" update g4_sc set sc_stock = sc_stock +'$sco[or_cnt]', sc_sell = sc_sell -'$sco[or_cnt]' where sc_id = '$wr_id' and sc_no = '$sc_no' ");
} //##################대기자가 있다면 끝

// 주문자정보 대기자로 업데이트
mysql_query(" update g4_sc_order set or_st = '0', or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and mb_id = '$mb_id' and or_st = '1' ");

if ($member[mb_id] == $write[mb_id]) { //--------판매자에의한 취소의경우
             //주문자에게 쪽지보내기~
   $tmp_row = sql_fetch(" select max(me_id) as max_me_id from $g4[memo_table] ");
   $me_id = $tmp_row[max_me_id] + 1;
   
   $team_dall = substr($g4[time_ymdhis],0,4).".".substr($g4[time_ymdhis],5,2).".".substr($g4[time_ymdhis],8,2)." (".get_yoil($g4[time_ymdhis]).") ".substr($g4[time_ymdhis],11,5);
   
   $recv_mb_id   = $mb_id;
   $memo="{$write[wr_6]})의 특가담당자가 {$team_dall} 주문을 취소처리하였습니다.\\n다음 기회에 좀더 특별한 혜택으로 만나길 희망합니다.\\n감사합니다.\\n특가주소 : http://$_SERVER[SERVER_NAME]/$bo_table/$wr_id";
        $sql2 = " insert into $g4[memo_table]
                    set me_id = '$me_id',
                    me_recv_mb_id = '$recv_mb_id',
                    me_send_mb_id = '$write[mb_id]',
                    me_send_datetime = '$g4[time_ymdhis]',
                    me_memo = '$memo' ";
        sql_query($sql2);
        // 실시간 쪽지 알림 기능
        sql_query(" UPDATE $g4[member_table] SET mb_memo_call = '$write[mb_id]' WHERE mb_id = '$recv_mb_id' ");
  } //--------판매자에의한 취소의경우

?>
// 참고만 하세요

$sql = "주문정보와 회원정보를 조인하여 회원포인트가 주문포인트와  같거나 큰거만 불러오기"
$result = sql_query($sql);
while ($scover = sql_fetch_array($result)) {
    //신청포인트만큼 차감
    //회원정보의 포인트 갱신
    // 대기자정보 업데이트
    // 주문자정보 대기자로 업데이트
    //남는수량만큼 대기자정보 새로추가
}

슈와이님의 뜻은 처음부터 대기자의 순으로 불러오는게 아닌 거기에 포인트까지 함께 불러오란거군요.
근데 제 의도는 대기자의 우선순위가 중요한데 자신이 대기자 1순위 인데도 왜 다음대기자에게 밀리는지 이유는 알아야할거 같아서요.
지금 제 소스에는 그 사실을 알리는 쪽지보내기가 제외됐지만 포인트가 부족시 왜 다음사람에게 넘어갓는지 쪽지로 알릴려고하거든요.
그래서 처음부터 포인트가 있는사람을 포함시키기에는 무리가 잇지않나 생각해봐요 ㅡㅜ

//전체대기자뽑음
$scover = sql_fetch("select * from g4_sc_order where sc_id = '$wr_id' and or_st = '0' and sc_no = '$sc_no' order by or_datetime limit 0,15");
while($scover = mysql_fetch_array($result)) { //############## 루프돌림
if ($scover) { //###########대기자가 있다면
         if ($sco[or_cnt]<$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@@@@주문자보다 대기자의 수량이 더 많다면
   $point_save =  $write[wr_7]*$sco[or_cnt]; //-------수량에 따른 포인트값 계산
         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
            continue; //$$$$$$$$$$$$$$$$ 루프다시돌림.
           
           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }

         $mocnt = $scover[or_cnt] - $sco[or_cnt]; //대기자의 수량에서 취소자의 수량뺌
   $moprice = $scover[or_price] - $sco[or_price]; //대기자의 금액에서 취소자의 금액뺌
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1', or_cnt = '{$sco[or_cnt]}', or_price = '{$sco[or_price]}' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
         //남는수량만큼 대기자정보 새로추가
   $sql = " insert into g4_sc_order
              set sc_id = '$wr_id',
                    sc_product = '{$scover[sc_product]}',
                    sc_name = '{$scover[sc_name]}',
                    sc_no = '{$scover[sc_no]}',
                    mb_id = '$mb_id',
                    or_cnt = '{$mocnt}',
                    or_price = '{$moprice}',
                    or_name = '{$scover[or_name]}',
                    or_bank = '{$scover[or_bank]}',
                    or_tel = '{$scover[or_tel]}',
                    or_addr = '{$scover[or_addr]}',
                    or_ip = '{$scover[or_ip]}',
                    or_memo = '{$scover[or_memo]}',
                    or_datetime = '{$scover[or_datetime]}',
                    or_st = '0' ";
        sql_query($sql);
        
   }else if ($sco[or_cnt]>$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@주문자보다 대기자의 수량이 적다면
                                   $point_save =  $write[wr_7]*$scover[or_cnt]; //-------수량에 따른 포인트값 계산
                                         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
            continue; //$$$$$$$$$$$$$$$$ 루프다시돌림.
           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }
   $modcnt = $sco[or_cnt] - $scover[or_cnt]; //취소자의 수량에서 대기자의 수량뺌
   $modprice = $sco[or_price] - $scover[or_price]; //취소자의 금액에서 대기자의 금액뺌
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
   // 취소자정보 업데이트
         mysql_query(" update g4_sc_order set or_cnt = '$modcnt', or_price = '$modprice' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '$mb_id' and or_st = '1' ");
   continue; //$$$$$$$$$$$$$$$$ 루프다시돌림.
 
        }else if ($sco[or_cnt]==$scover[or_cnt]) { //@@@@@@@@@@@@@@@@@@@주문자 대기자 수량이 같다면

                                        $point_save =  $write[wr_7]*$scover[or_cnt]; //-------수량에 따른 포인트값 계산
                                         $idp = get_member($scover['mb_id'], mb_point);
                                        
           if ($idp[mb_point]<$point_save) { //신청포인트부족시
            // 대기자정보 신청포인트미달로 대기자 하락 업데이트
                                             mysql_query(" update g4_sc_order set or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
            continue; //$$$$$$$$$$$$$$$$ 루프다시돌림.
 
           }else{
              //신청포인트만큼 차감
    $query="insert g4_point values ('', '{$scover[mb_id]}', now(), '$wr_id 특가 신청포인트 차감', '-$point_save', '$bo_table', '$wr_id', '특가찬스')";
    $resultt=mysql_query($query);
      
    //회원정보의 포인트 갱신
    mysql_query("update g4_member set mb_point=mb_point-'$point_save' where mb_id='{$scover[mb_id]}'");
           }
   // 대기자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '1' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '{$scover[mb_id]}' and or_st = '0' ");
   // 취소자정보 업데이트
         mysql_query(" update g4_sc_order set or_st = '0', or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and sc_no = '$sc_no' and mb_id = '$mb_id' and or_st = '1' ");

  } //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@수량비교끝
}else{ //###############대기자가 없다면
// 상품수량증가 업데이트
mysql_query(" update g4_sc set sc_stock = sc_stock +'$sco[or_cnt]', sc_sell = sc_sell -'$sco[or_cnt]' where sc_id = '$wr_id' and sc_no = '$sc_no' ");
} //##################대기자가 있다면 끝
 
break; //$$$$$$$$$$$$$$$걸리는게 없음 나가라......
} //######## 루프끝
 
// 주문자정보 대기자로 업데이트
mysql_query(" update g4_sc_order set or_st = '0', or_datetime = '$g4[time_ymdhis]' where sc_id = '$wr_id' and mb_id = '$mb_id' and or_st = '1' ");
답변을 작성하시기 전에 로그인 해주세요.
전체 129,406 | RSS
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT