選擇查詢的MySQL我已經花費超過24小時,試圖運行更新或選擇查詢,但選擇查詢完成,更新後插入查詢或插入查詢時submite「displayid」運行更新或PHP
從未做過後插入查詢code ##
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='$pmphone', 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);
}
}
試試'如果(isset($ _ POST) 「displayid」])'代替'如果($ _ POST [ 「displayid」] = = TRUE)'。瞭解準備好的語句以防止SQL注入 – Jens
試試這個$ conn-> query($ sqlfail);到這個mysqli_query($ conn,$ sqlfail); – JYoThI
我使用連接作爲$ conn = new mysqli($ servername,$ username,$ password,$ dbname); – soma