Пытаюсь сделать подобие формы регистрации но появляется ошибка Ошибка: 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 ' passwd, Вася)' at line 1
форма
<form method="post" action="cradmin.php">
<label for="id">id</label>
<input type="text" id="id" name="id" required>
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
<label for="name">name</label>
<input type="text" id="name" name="name" required>
<button type="submit">Register</button>
</form>
php обработчик
<?php
$conn = new mysqli("зачем", "вам", "это", "знать?");
if($conn->connect_error){
die("Ошибка: " . $conn->connect_error);
}
$name = $_POST["name"];
$login = $_POST["login"];
$pass = $_POST["password"];
$id = $_POST["id"];
$sql = "INSERT INTO admins (id, login, pass, name) VALUES ($id, $login, $pass, $name)";
if($conn->query($sql)){
echo "Данные успешно добавлены";
} else{
echo "Ошибка: " . $conn->error;
}
$conn->close();
?>
ну и запрос
INSERT INTO admins (id, login, pass, name) VALUES ($id, $login, $pass, $name)