我有个问题:
$ManagerName = $mysqli->real_escape_string($_POST['ManagerName']);
$Password = encryptIt($_POST['Password']);
$Address = $mysqli->real_escape_string($_POST['Address']);
$Email = $mysqli->real_escape_string($_POST['Email']);
$PhoneNo = $mysqli->real_escape_string($_POST['PhoneNo']);
$OfficeName = $mysqli->real_escape_string($_POST['OfficeName']);
$ConsignmentNo = $_POST['percel'];
$status = 'In Transit';
$det = explode(",",$ConsignmentNo);
$sql = "INSERT INTO tbl_courier_officers (officer_name, off_pwd, address, email, ph_no, office, consignment, status, reg_date)
VALUES ('$ManagerName', '$Password', '$Address', '$Email', '$PhoneNo', '$OfficeName','$ConsignmentNo','$status', NOW())";
$done = mysqli_query($mysqli, $sql);
if($done){
echo "added";
foreach($det as $valuez)
{
$m = $Email;
mysqli_query($mysqli,"INSERT INTO courier_track (email, percel_num) values('$m', '$valuez')");
}
mysqli_query($mysqli, "insert into user_log (username,name,action,time, user_id, mydate, mtime)values('$uname','$fullname','Added $ManagerName to courier officers table', '$tv', '$id', '$t', '$tv')");
}else{
echo 'Error occured: '.$mysqli->error;
}
在第一次插入为true之后,我要提交第二个查询,它是foreach循环。我希望它提交值发生的次数,但它在第一次插入后不提交。
除foreach中的查询外,所有查询都在工作。
有人能告诉我该怎么办吗?
1条答案
按热度按时间vfh0ocws1#
更改这段代码
错误通知如下
然后您将了解insert语句中的错误。
如果不起作用,就打印一张纸($det);把它加到运算表上,这样我们就能正确地解决问题