0
Subject Update Failed!!You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
I am stuck here can anyone help me what I am missing in this code.The error is in Update Query.
Dreamviwerコードエディタソフトウェアを使用していますが、コードを記述するときに文法エラーは発生しません。 //フォームほとんどの場合は、パラメータの名前を入力ミス件名の更新に失敗しました
$id= $current_subject["Id"];
$name=mysql_prep($_POST["Name"]);
$position=(int)$_POST["Position"];
$visible=(int)$_POST["Visible"];
$query="UPDATE subjects SET Name='{$name}',Position=$position,Visible=$visible WHERE Id={$id}";
$result= mysqli_query($conn, $query);
if($result && mysqli_affected_rows($conn)==1){
//success
$_SESSION["message"]="Subject updated.";
redirect_to("manage_content.php");
}else{
//Failure
$message="Subject Update Failed" . $conn->error;
}
mysql_prepとは何ですか?あなたはUPDATEクエリで{}を削除する必要があると思います。 –
'echo $ query'。構文エラーを見つけたら、あなたの尻尾をタックしてください。 –