一个语句的疏忽,排查了半天----引以为戒

		$count = self::$redis->lLen('server_name');
		while($count > 0){


			$server_name  = self::$redis->rPop('server_name');
			$mytime 	 = self::$redis->rPop('mytime');
			$status  = self::$redis->rPop('status') ;
			$client_name 	 = self::$redis->rPop('client_name');
			$content = self::$redis->rPop('content');

			/*
				客服对话是否解决和等级评分以 用户为主题重新设立一张表
			*/

			if(self::$redis->sIsMember('kefus',$server_name)){
				self::$redis->sRem('kefus',$server_name);

				$sql = " SELECT servername FROM kefus WHERE servername = '$server_name'; ";
				self::$mysqli->query($sql);
				if(self::$mysqli->affected_rows == 0 && $server_name != 'robot'){
					$sql = " INSERT INTO kefus (servername,nickname) VALUES('$server_name','$server_name'); ";
					self::$mysqli->query($sql);							
				}
			}

			if($server_name == 'robot'){
				$sql = " INSERT INTO robot (clientname,mytime,content,status,rank,isfinish) VALUES('$client_name','$mytime','$content','$status',5,1); ";
				self::$mysqli->query($sql);
				continue;
			}

			// $sql = " INSERT INTO users(client,rank,isfinish) 
			// 	VALUES('client',1,1); ";
			// self::$mysqli->query($sql);

			$sql = " CREATE TABLE IF NOT EXISTS `$server_name` (
					id INT(11) PRIMARY KEY NOT NULL AUTO_INCREMENT,
					mytime VARCHAR(12) NOT NULL,
					status INT(2) NOT NULL,
					clientname VARCHAR(30) NOT NULL,
					content VARCHAR(255) NOT NULL
				); ";
			self::$mysqli->query($sql);

			$sql = " INSERT INTO `$server_name` (mytime,status,clientname,content) VALUES ('$mytime','$status','$client_name','$content'); ";
			self::$mysqli->query($sql);
			$count--;
		}



就因为自己没有写$count--,找bug找了半天,真的半天!细节决定成败,基础一定要打扎实!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值