修改表数据

	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;
			}
		}
	
	}

修改表数据

posted @ 2016-04-28 14:26  ready_dream  阅读(124)  评论(0编辑  收藏  举报