网站很奇怪,一般购买没问题,但是剩余最后个购买人次的时候就会出现如下错误
提示
MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
MySQL Errno: 1064
MySQL Message: INSERT INTO `go_member_go_record` (`code`,`code_tmp`,`uid`,`username`,`uphoto`,`shopid`,`shopname`,`shopqishu`,`gonumber`,`moneycount`,`goucode`,`pay_type`,`ip`,`status`,`time`) VALUES
网站关键底码部分
$shop['goods_count_num'] = $codes_len;
$this->shoplist[$key] = $shop;
if($codes_len){
$insert_html.="('$dingdancode','$dingdancode_tmp','$uid','$username','$uphoto','$shop[id]','$shop[title]','$shop[qishu]','$codes_len','$money','$codes','$pay_type','$ip','$status','$time'),";
}
}
$sql="INSERT INTO `@#_member_go_record` (`code`,`code_tmp`,`uid`,`username`,`uphoto`,`shopid`,`shopname`,`shopqishu`,`gonumber`,`moneycount`,`goucode`,`pay_type`,`ip`,`status`,`time`) VALUES ";
$sql.=trim($insert_html,',');
//$this->db->Query("set global max_allowed_packet = 2*1024*1024*10");
return $this->db->Query($sql);
}
//开始支付
public function go_pay($pay_checkbox){
if($this->members['money'] >= $this->MoenyCount){
$uid=$this->members['uid'];
$pay_1 = $this->pay_bag();
if(!$pay_1){return $pay_1;}
$dingdancode=$this->dingdancode;
$pay_2 = pay_go_fund($this->goods_count_num);
$pay_3 = pay_go_yongjin($uid,$dingdancode);
return $pay_1;
}
if(!is_array($this->pay_type)){
return 'not_pay';
}
if(is_array($this->scookies_arr)){
$scookie = serialize($this->scookies_arr);
}else{
$scookie= '0';
}
if($pay_checkbox){
$money = $this->MoenyCount - $this->members['money'];
return $this->addmoney_record($money,$scookie);
}else{
// echo $this->MoenyCount."|".$scookie;
// exit;
//全额支付
$this->MoenyCount;
return $this->addmoney_record($this->MoenyCount,$scookie);
}
exit;
}
//账户里支付
private function pay_bag(){
$time=time();
2 个解决方案
#1
数据库部分
--
-- 表的结构 `go_member_go_record`
--
CREATE TABLE `go_member_go_record` (
`id` int(10) unsigned NOT NULL auto_increment,
`code` char(20) default NULL COMMENT '订单号',
`code_tmp` tinyint(3) unsigned default NULL COMMENT '相同订单',
`username` varchar(30) NOT NULL,
`uphoto` varchar(255) default NULL,
`uid` int(10) unsigned NOT NULL COMMENT '会员id',
`shopid` int(6) unsigned NOT NULL COMMENT '商品id',
`shopname` varchar(255) NOT NULL COMMENT '商品名',
`shopqishu` smallint(6) NOT NULL default '0' COMMENT '期数',
`gonumber` smallint(5) unsigned default NULL COMMENT '购买次数',
`goucode` longtext NOT NULL COMMENT '一元杀码',
`moneycount` decimal(10,2) NOT NULL,
`huode` char(50) NOT NULL default '0' COMMENT '中奖码',
`pay_type` char(10) default NULL COMMENT '付款方式',
`ip` varchar(255) default NULL,
`status` char(30) default NULL COMMENT '订单状态',
`time` char(21) NOT NULL COMMENT '购买时间',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `shopid` (`shopid`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='一元杀记录表' AUTO_INCREMENT=2126 ;
--
-- 导出表中的数据 `go_member_go_record`
--
INSERT INTO `go_member_go_record` VALUES (1, 'A14010956484394982', 0, '158****4674', 'photo/member.jpg', 1, 1, '闪闪故事王XZ-011', 1, 1, '10000067', 1.00, '0', '账户', '浙江省温州市,115.221.9.191', '已付款,未发货,未完成', '1401095648.473');
--
-- 表的结构 `go_member_go_record`
--
CREATE TABLE `go_member_go_record` (
`id` int(10) unsigned NOT NULL auto_increment,
`code` char(20) default NULL COMMENT '订单号',
`code_tmp` tinyint(3) unsigned default NULL COMMENT '相同订单',
`username` varchar(30) NOT NULL,
`uphoto` varchar(255) default NULL,
`uid` int(10) unsigned NOT NULL COMMENT '会员id',
`shopid` int(6) unsigned NOT NULL COMMENT '商品id',
`shopname` varchar(255) NOT NULL COMMENT '商品名',
`shopqishu` smallint(6) NOT NULL default '0' COMMENT '期数',
`gonumber` smallint(5) unsigned default NULL COMMENT '购买次数',
`goucode` longtext NOT NULL COMMENT '一元杀码',
`moneycount` decimal(10,2) NOT NULL,
`huode` char(50) NOT NULL default '0' COMMENT '中奖码',
`pay_type` char(10) default NULL COMMENT '付款方式',
`ip` varchar(255) default NULL,
`status` char(30) default NULL COMMENT '订单状态',
`time` char(21) NOT NULL COMMENT '购买时间',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `shopid` (`shopid`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='一元杀记录表' AUTO_INCREMENT=2126 ;
--
-- 导出表中的数据 `go_member_go_record`
--
INSERT INTO `go_member_go_record` VALUES (1, 'A14010956484394982', 0, '158****4674', 'photo/member.jpg', 1, 1, '闪闪故事王XZ-011', 1, 1, '10000067', 1.00, '0', '账户', '浙江省温州市,115.221.9.191', '已付款,未发货,未完成', '1401095648.473');
#2
断点调试,看一下实际被执行的语句是什么?
#1
数据库部分
--
-- 表的结构 `go_member_go_record`
--
CREATE TABLE `go_member_go_record` (
`id` int(10) unsigned NOT NULL auto_increment,
`code` char(20) default NULL COMMENT '订单号',
`code_tmp` tinyint(3) unsigned default NULL COMMENT '相同订单',
`username` varchar(30) NOT NULL,
`uphoto` varchar(255) default NULL,
`uid` int(10) unsigned NOT NULL COMMENT '会员id',
`shopid` int(6) unsigned NOT NULL COMMENT '商品id',
`shopname` varchar(255) NOT NULL COMMENT '商品名',
`shopqishu` smallint(6) NOT NULL default '0' COMMENT '期数',
`gonumber` smallint(5) unsigned default NULL COMMENT '购买次数',
`goucode` longtext NOT NULL COMMENT '一元杀码',
`moneycount` decimal(10,2) NOT NULL,
`huode` char(50) NOT NULL default '0' COMMENT '中奖码',
`pay_type` char(10) default NULL COMMENT '付款方式',
`ip` varchar(255) default NULL,
`status` char(30) default NULL COMMENT '订单状态',
`time` char(21) NOT NULL COMMENT '购买时间',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `shopid` (`shopid`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='一元杀记录表' AUTO_INCREMENT=2126 ;
--
-- 导出表中的数据 `go_member_go_record`
--
INSERT INTO `go_member_go_record` VALUES (1, 'A14010956484394982', 0, '158****4674', 'photo/member.jpg', 1, 1, '闪闪故事王XZ-011', 1, 1, '10000067', 1.00, '0', '账户', '浙江省温州市,115.221.9.191', '已付款,未发货,未完成', '1401095648.473');
--
-- 表的结构 `go_member_go_record`
--
CREATE TABLE `go_member_go_record` (
`id` int(10) unsigned NOT NULL auto_increment,
`code` char(20) default NULL COMMENT '订单号',
`code_tmp` tinyint(3) unsigned default NULL COMMENT '相同订单',
`username` varchar(30) NOT NULL,
`uphoto` varchar(255) default NULL,
`uid` int(10) unsigned NOT NULL COMMENT '会员id',
`shopid` int(6) unsigned NOT NULL COMMENT '商品id',
`shopname` varchar(255) NOT NULL COMMENT '商品名',
`shopqishu` smallint(6) NOT NULL default '0' COMMENT '期数',
`gonumber` smallint(5) unsigned default NULL COMMENT '购买次数',
`goucode` longtext NOT NULL COMMENT '一元杀码',
`moneycount` decimal(10,2) NOT NULL,
`huode` char(50) NOT NULL default '0' COMMENT '中奖码',
`pay_type` char(10) default NULL COMMENT '付款方式',
`ip` varchar(255) default NULL,
`status` char(30) default NULL COMMENT '订单状态',
`time` char(21) NOT NULL COMMENT '购买时间',
PRIMARY KEY (`id`),
KEY `uid` (`uid`),
KEY `shopid` (`shopid`),
KEY `time` (`time`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='一元杀记录表' AUTO_INCREMENT=2126 ;
--
-- 导出表中的数据 `go_member_go_record`
--
INSERT INTO `go_member_go_record` VALUES (1, 'A14010956484394982', 0, '158****4674', 'photo/member.jpg', 1, 1, '闪闪故事王XZ-011', 1, 1, '10000067', 1.00, '0', '账户', '浙江省温州市,115.221.9.191', '已付款,未发货,未完成', '1401095648.473');
#2
断点调试,看一下实际被执行的语句是什么?