mysql-请教一个这个法中的两个字段UPDATA的顺序
Jun 02, 2016 am 11:31 AMmysqlphp
<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>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot tools Tags

Hot Article
Repo: How To Revive Teammates
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
How Long Does It Take To Beat Split Fiction?
3 weeks ago
By DDD
R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks ago
By 尊渡假赌尊渡假赌尊渡假赌

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

11 Best PHP URL Shortener Scripts (Free and Premium)

Working with Flash Session Data in Laravel

Build a React App With a Laravel Back End: Part 2, React

Simplified HTTP Response Mocking in Laravel Tests

cURL in PHP: How to Use the PHP cURL Extension in REST APIs

12 Best PHP Chat Scripts on CodeCanyon
