[英]SQL syntax error (with procedural insert)
我需要對不同的表執行兩個查詢。 我已經測試了代碼打擊:
$insert= $mysqli->query("BEGIN;INSERT INTO
patient(patient_firstName,patient_familyName,patient_age,patient_emailAddress, patient_physicalAddress,
patient_mobile,date_of_register,uusernamee,ppasswordd)
values('1','1','1','1','1','1','1','1','1');insert into
patient_requests(patient_id,subject,description)values('222','22222','22222'); Commit; ") ;
這是它顯示的錯誤:
您的SQL語法有誤; 檢查與您的MySQL服務器版本對應的手冊以獲取正確的語法,以在第1()行的'INSERT INTO Patient(Patient_firstName,Patient_familyName,Patient_age,Patient_')附近使用
我在哪里錯?
提前致謝..!
如果要在單個數據庫事務中執行多個INSERT
,則可以嘗試以下方式:
// begin DB transaction
$mysqli->begin_transaction(MYSQLI_TRANS_START_READ_ONLY);
// multiple inserts queries
$mysqli->query("INSERT INTO ....");
$mysqli->query("INSERT INTO ....");
$mysqli->commit();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.