当我按下更改按钮时,我想从我的输入字段中获取新值并覆盖数据库中的当前值。但出现错误500
<?php session_start();
if (isset($_POST['change-btn'])) {
require 'datalink.php'; // this links the website to the database
$user_name = $_POST['user_Name']; //this is username
$fName = $_POST['Fname'];
$lName = $_POST['Lname']
$fName = ucfirst($fName);
$lName = ucfirst($lName);
$user_name = ucfirst($user_name)
$sql = "SELECT User_name FROM users WHERE User_name=?";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../signup.php?error=sqlerror");
exit();
}
else {
mysqli_stmt_bind_param($stmt , "s", $user_name);
mysqli_stmt_execute($stmt);
mysqli_stmt_store_result($stmt);
$resultCheck = mysqli_stmt_num_rows($stmt);
if ($resultCheck > 0) {
header("location: ../signup.php?error=usertaken&mail=".$email);
exit();
}
else {
$sql = "UPDATE users (User_name, Fname, Sname) VALUES (?, ?, ?)";
$stmt = mysqli_stmt_init($conn);
if (!mysqli_stmt_prepare($stmt, $sql)) {
header("location: ../signup.php?error=sqlerror");
exit();
}
// this if the user successfully signs up
else {
mysqli_stmt_bind_param($stmt , "sss", $user_name, $fName ,$lName);
mysqli_stmt_execute($stmt);
header("location: ../accounts.php?update=success");
exit();
}
}
}
}
mysqli_stmt_close($stmt);
mysqli_close($conn);
}
// this stops the user accessing the signupinc.php file.
else {
header("location: ../accounts.php");
exit();
}
我尽一切努力使代码工作均失败并出现错误500,我要做的就是让网站更改名字,姓氏和用户名