0
只是在將記錄插入我的MYSQL表時有點問題。數據正常,但是當代碼查詢是否有條目時,我總是收到一個錯誤。PHP通過MYSQLI插入記錄,但總是給出錯誤回聲
$sql = mysqli_query($connect,"INSERT INTO testtable (fnhusband,fnwife,surname,email,address,suburb,city,postcode,region,number,altnumber)
VALUES ('$fnhusband','$fnwife','$surname','$email','$address','$suburb','$city','$postcode','$region','$number','$altnumber')");
if (!mysqli_query($connect,$sql))
{
die('Error:' . mysqli_error());
}
else {
echo "1 record added";
mysqli_close($connect);
}
很酷,有什麼錯誤? – Scuzzy 2013-03-07 00:20:38
從查詢檢查中刪除$ connect並向我們顯示結果。 – Stepo 2013-03-07 00:21:24
你實際上是這樣做的:'mysqli_query($ connect,mysqli_query($ connect,「INSERT ....」));',第一個(內部)成功,第二個失敗。 – Wrikken 2013-03-07 00:23:59