我试图在选择查询返回0(未找到原始数据)后插入到多表中选择查询工作和插入查询从未完成时,子网站“displayid”并且没有任何语法错误
代码:
<?php
if ($_POST["displayid"] == TRUE) {
$sqlid = "SELECT * FROM doc1 WHERE idnum ='$pidnum' AND stats='$ok'";
$result = mysqli_query($conn, $sqlid);
if (mysqli_num_rows($result) > 0) {
$sqlup = "UPDATE doc1 SET m_phone='$pm_phone', seen='$dataseen' WHERE idnum ='$pidnum'";
mysqli_query($conn, $sqlup);
$found = 1;
} else {
$found = 0;
$sqlfail = "INSERT INTO fail(fname,lname,tname,funame,idnum,m_phone,reg_date)
VALUES ('$pfname','$plname','$ptname','$pfuname','$pidnum','$pm_phone','$todaydate')";
$conn->query($sqlfail)
}
}
?>
答案 0 :(得分:1)
使用此代码:
$sqlfail = "INSERT INTO fail(fname,lname,tname,funame,idnum,m_phone,reg_date)
VALUES ('".$pfname."','".$plname."','".$ptname."','".$pfuname."','".$pidnum."','".$pm_phone."','".$todaydate."')";
对更新命令进行类似的更改
答案 1 :(得分:1)
你实际上有一个错误
$conn->query($sqlfail)
应该是
$conn->query($sqlfail);
答案 2 :(得分:0)
AND stats='$ok'";
我无法看到具有此名称的变量我认为您的意思是AND stats='ok'";