mysql-請教一個這個法中的兩個欄位UPDATA的順序

來源:互聯網
上載者:User
關鍵字 mysql php
mysqlphp

下面這個方法有一個更新資料庫的操作,想請問大神們        下面這兩個變數裡面的值是更新在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;        }}//
  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.