Re: 배송처리 개발 php 복잡한거 그냥 쿼리로 해결

Re: 배송처리 개발 php 복잡한거 그냥 쿼리로 해결

더시민 1 753 0

            if($R['delivery']=='1') {//배숭중인경우에
                if($R['site']=='1') { //국문
                    if((strtotime($delivery_date) - strtotime($R['delivery_date']."+3 days")) > 0) {//3일이 지났다면
                        db_query("update @@@@@ set delivery ='2' where uid = '".$R['uid']."' " , $DB_CONNECT);                    
                    }
                }
                if($Delivery_tmp['site']=='4') { //영문
                    if((strtotime($delivery_date) - strtotime($R['delivery_date']."+30 days")) > 0) {//30일이 지났다면
                        db_query("update @@@@@ set delivery ='2' where uid = '".$R['uid']."' " , $DB_CONNECT);                    
                    }            
                }            
            }

php 코드 제어 없이 sql 한방으로는 

    db_query("update @@@@@ set delivery = '2' where site='1' and delivery = '1' and cast(delivery_date as unsigned)  < '".date("YmdHis", strtotime("-3 days"))."'", $DB_CONNECT);
    db_query("update @@@@@  set delivery = '2' where site='1' and delivery = '1' and cast(delivery_date as unsigned)  < '".date("YmdHis", strtotime("-30 days"))."'", $DB_CONNECT);

1 Comments
더시민 2021.09.07 19:40  
$delivery_cron = db_query("select * from [email protected]@@@@@ where site='1' and delivery = '1' and cast(delivery_date as unsigned)  < '".date("YmdHis", strtotime("-3 days"))."'", $DB_CONNECT);
db_query("update @@@@@@ set delivery = '2' where site='1' and delivery = '1' and cast(delivery_date as unsigned)  < '".date("YmdHis", strtotime("-3 days"))."'", $DB_CONNECT);
db_query("update @@@@@@  set delivery = '2' where site='4' and delivery = '4' and cast(delivery_date as unsigned)  < '".date("YmdHis", strtotime("-30 days"))."'", $DB_CONNECT);
while($XR=db_fetch_array($delivery_cron)){
print_r($XR);
}
제목
Category
Facebook Twitter GooglePlus KakaoStory KakaoTalk NaverBand