$SetID=$_REQUEST[ID];
//分离价格类型
$temp_day = "";
$temp_ary = $_POST[SetCountID];
for($a=0;$a<count($temp_ary);$a++){
$temp_day = empty($temp_day) ? $temp_ary[$a] : $temp_day.",".$temp_ary[$a];
}
if (count($temp_ary)>1){
$temp_day="0,".$temp_day;
}else{
$temp_day=$temp_day;
}
///分离出发日期
$temp_str = "";
$shyt = $_POST[SetCountID2];
for($i=0;$i<count($shyt);$i++){
$temp_str = empty($temp_str) ? $shyt[$i] : $temp_str.",".$shyt[$i];
}
$ClassCot=explode(",",$temp_str);
//插入数据for($i=0;$i<count($ClassCot);$i++){
$SetDayTime=gmdate("Y-m-d",strtotime("+$_REQUEST[SetDay] day",strtotime($ClassCot[$i])));
//echo $SetDayTime;
$Insert_Days="insert into setdays(TeamDate,ReturnDate,PlaneNums,TakeNums,P_ID,,YnDisable,Adddate)values('$ClassCot[$i]','$SetDayTime','$_POST[PeopleNums]','0','$SetID','0',now())";
echo $Insert_Days;
mysql_query($Insert_Days);
}
折腾了好几天了,sql语句也都能得到,相应的数值就是添加不上CREATE TABLE `setdays` (
`ID` int(11) NOT NULL auto_increment,
`TeamDate` date NOT NULL,
`ReturnDate` date NOT NULL,
`PlaneNums` int(11) NOT NULL default '0',
`TakeNums` int(11) NOT NULL default '0',
`P_ID` int(11) NOT NULL default '0',
`BookingId` varchar(255) NOT NULL,
`YnDisable` int(11) NOT NULL default '0',
`Adddate` datetime NOT NULL,
PRIMARY KEY (`ID`)
) ENGINE=InnoDB AUTO_INCREMENT=160 DEFAULT CHARSET=gbk到底是什么原因,没有任何报错。郁闷中
$Insert_Days="insert into setdays(TeamDate,ReturnDate,PlaneNums,TakeNums,P_ID,YnDisable,Adddate)values('$ClassCot[$i]','$SetDayTime','$_POST[PeopleNums]','0','$SetID','0',now())";
echo $Insert_Days;
mysql_query($Insert_Days);
去掉多余的逗号也是不行
贴出结果
这是循环出来的SQL语句