> 백엔드 개발 > PHP 튜토리얼 > mysql-请教一个这个法中的两个字段UPDATA的顺序

mysql-请教一个这个法中的两个字段UPDATA的顺序

WBOY
풀어 주다: 2016-06-02 11:31:37
원래의
1280명이 탐색했습니다.

mysqlphp

<code>下面这个方法有一个更新数据库的操作,想请问大神们        下面这两个变量里面的值是更新在if($shijiancha){****}这个判断前面还是后面?因为数据库里面保存的数据是没有经过if($shijiancha){****}这个判断里面操作的,如果想保存在操作之后要怎么写呢?新手PHP请大家多多指教,谢谢!$content = addslashes($tocode->go_content);    $counttime = $tocode->count_time;public function autolottery_ret_install(){    if(!isset($_POST['shopid'])){        echo '-1';exit;    }    $id = intval($_POST['shopid']);    $this->db->Autocommit_start();    $shop_info = $this->db->GetOne("select * from `@#_shoplist` where `id` = '$id' for update");    if(!$shop_info){        echo '-1'; exit;    }    if($shop_info['xsjx_time'] > time()){        echo "-4";exit;    }    if($shop_info['canyurenshu']=='0'){        //$shop_info['canyurenshu'] = rand(1,$shop_info['zongrenshu']);        echo '-3';exit;    }    if(!empty($shop_info['q_user_code']) && ($shop_info['q_showtime'] == 'Y')){            echo '-6';exit;    }    if(!empty($shop_info['q_user_code']) && ($shop_info['q_showtime'] == 'N')){        echo $shop_info['q_user_code']; exit;    }    $shop_info['xsjx_time']=$shop_info['xsjx_time'].'.000';    $tocode = System::load_app_class("tocode","pay");    $tocode->run_tocode($shop_info['xsjx_time'],100,$shop_info['canyurenshu'],$shop_info);    $code =$tocode->go_code;    $content = addslashes($tocode->go_content);    $counttime = $tocode->count_time;    $shishicai = $tocode->shishicai;    $shijiancha = $tocode->shijiancha;    if($shijiancha){//      $this->curl->getshishicai();        $update_member_info = $db->GetOne("select * from `@#_member_go_record` where `shopid` = '$shop[id]' and `shopqishu` = '$shop[qishu]' and member_type=1 ORDER BY RAND() LIMIT 1");        $member_time_arr = explode('.',$update_member_info['time']);        $shijian = $member_time_arr['0'].$member_time_arr['1'];        $update_cha_time = (int)$shijian+(int)$shijiancha;        $member_update_time = substr_replace($update_cha_time,".",10,0);        $db->Query("UPDATE `@#_member_go_record` SET `time` = '$member_update_time' where `shopid` = '$shop[id]' and `shopqishu` = '$shop[qishu]' and uid='$update_member_info[uid]'");    }    $u_go_info = $this->db->GetOne("select * from `@#_member_go_record` where `shopid` = '$shop_info[id]' and `shopqishu` = '$shop_info[qishu]' and `goucode` LIKE  '%$code%'");    if($u_go_info){            $u_info = $this->db->GetOne("select * from `@#_member` where `uid` = '$u_go_info[uid]'");            $u_info['username'] = _htmtocode($u_info['username']);            $q_user = serialize($u_info);            $q_uid = $u_info['uid'];    }else{            $reg_code = $this->suan_zd_code($shop_info['id'],$code);            if(!$reg_code){echo '-2';exit;}            $u_go_info = $this->db->GetOne("select * from `@#_member_go_record` where `shopid` = '$shop_info[id]' and `shopqishu` = '$shop_info[qishu]' and `goucode` LIKE  '%$reg_code%'");            $u_info = $this->db->GetOne("select * from `@#_member` where `uid` = '$u_go_info[uid]'");            $u_info['username'] = addslashes($u_info['username']);            $q_user = serialize($u_info);            $q_uid = $u_info['uid'];    }    if($u_info['type']==1){        $member_type = 1;    }else{        $member_type = 0;    }    $q_1 = $this->db->Query("UPDATE `@#_shoplist` SET                            `q_uid` = '$q_uid',                            `q_user` = '$q_user',                            `member_type` = '$member_type',                            `q_user_code` = '$code',                            `q_content` = '$content',                            `q_counttime` ='$counttime',                            `shishicai` ='$shishicai',                            `q_end_time` = '$shop_info[xsjx_time]',                            `q_showtime` = 'Y'                             where `id` = '$id'");        if($u_go_info){                $q_2 = $this->db->Query("UPDATE `@#_member_go_record` SET `huode` = '$code' where `id` = '$u_go_info[id]'");        }else{                $q_2 = true;        }        $q_3 = $this->autolottery_install($shop_info);        if($q_1 && $q_2 && $q_3){                $this->db->Autocommit_commit();                //echo $code."云凑码";exit;                echo '-6';exit;        }else{            $this->db->Autocommit_rollback();            echo '-2';exit;        }}//</code>
로그인 후 복사
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿