$tran = "START TRANSACTION;";
$tran_res = mysql_query($tran);
$qry_1 = "INSERT INTO docList (doc_ip , doc_country , doc_ref) VALUES ('$ip' , '$country' , '$http_ref');";
$res_1 = mysql_query($qry_1);
if(!$res_1)
die ("qry1 fail " . mysql_error());
$ins_id = mysql_insert_id();
if(!$ins_id)
die ("ins id fail " . mysql_error());
echo "<b>$ins_id</b>";
$qry_2 = "INSERT INTO docContent (doc_id , cont_date , cont_title , cont_aim , cont_obj , cont_theory , cont_sw , cont_code) VALUES ('$ins_id' , '$dt' , '$title' , '$aim' , '$obj' , '$th' , '$sw' , '$code');";
$res_2 = mysql_query($qry_2);
if(!$res_2)
die("qry2 fail " . mysql_error()); `
の上に次のエラーが返されるの実行:PHP - MySQLのトランザクションの実行エラー
2 qry fail
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'login'); if($query->num_rows()>0) return $query->result_array(); } ' at line 1
$qry_2
の実行が失敗している影響で
が、私はそれが誤りで当惑していますエラーノートに記載されているような1行目にそのようなコードはありません。さらに、クエリ($qry_2
)はMySqlコンソールで正しく実行されます。
あなたの変数を消毒していないように見えます。 – JJJ
@Juhanaあなたは正しいです!それは今働いている。 – AFV