zoukankan      html  css  js  c++  java
  • 修改表数据

    	public function updatePhoneOp() {
    		set_time_limit(0);
    		$link=mysql_connect("localhost","root","root") or exit("数据库连接失败!");
    		$db=mysql_select_db("shop");
    		mysql_set_charset("utf8");
    		$select = "select member_id,member_mobile,member_email from 33hao_member where member_id < 5";
    		$result = mysql_query($select);
    		while($arr=mysql_fetch_assoc($result)) {
    			if(!empty($arr)){
    					
    				if(!empty($arr['member_mobile'])){
    					
    					if(preg_match("/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/",$arr['member_mobile'])){
    						//验证通过
    						
    						$update1="update 33hao_member set member_mobile_bind=1 where member_id = {$arr['member_id']} ";
    						mysql_query($update1);
    						//print_r($update1);
    						//exit();
    					}
    				}
    				if(!empty($arr['member_email'])){
    					//if (preg_match("/^[a-z]([a-z0-9]*[-_.]?[a-z0-9]+)*@([a-z0-9]*[-_]?[a-z0-9]+)+[.][a-z]{2,3}([.][a-z]{2})?$/i; ",$arr['member_email'])){
    						$update2="update 33hao_member set member_email_bind=1 where member_id = {$arr['member_id']}";
    						 mysql_query($update2);
    					//}
    				}
    				//$update1="update br_goods_common set goods_costprice={$arr['goods_price']} where goods_commonid={$arr['goods_commonid']} ";
    				//mysql_query($update1);
    				//$update2="update br_goods set goods_promotion_price={$arr['goods_price']} where goods_commonid={$arr['goods_commonid']}";
    				//mysql_query($update2);
    				$str="用户名id:{$arr['member_id']},修改成功";
    				file_put_contents("log.txt",$str.PHP_EOL,FILE_APPEND);
    				//echo $str;
    			}
    		}
    	
    	}
    

    修改表数据

  • 相关阅读:
    运输装备(codevs 1669)
    考前复习(codevs 2837)
    2014编程之美初赛第一场
    51系列小型操作系统精髓 简单实现
    数学----有趣的扑克牌《一》
    hadoop编程:分析CSDN注冊邮箱分布情况
    [动态规划]UVA437
    Swift学习笔记四:数组和字典
    [动态规划]UVA10285
    freemarker中的left_pad和right_pad
  • 原文地址:https://www.cnblogs.com/xiaoxiaomengxiangjia/p/5442553.html
Copyright © 2011-2022 走看看