ユーザー登録フォームに取り組んでいますが、mysql 構文エラーが発生しますが、理由はわかりません。
$username = mysqli_real_escape_string($con, $_POST['username']);
$email = mysqli_real_escape_string($con, $_POST['email']);
$password = md5(mysqli_real_escape_string($con, $_POST['password']));
$key = md5(rand(1, 1000));
$q = "INSERT INTO users (username, email, password, confirmed, key)
VALUES ('$username', '$email', '$password', 0, '$key')";
mysqli_query($con, $q) or die(mysqli_error($con)." Q=".$q);
接続は問題ないので問題ありません。それは私にこのエラーを与えています:
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 'key) VALUES ('jirikrewinkel',
'jiri@mail.com', '29940b146d722a311446ca2d68f9739d' at line 1
Q=INSERT INTO users (username, email, password, confirmed, key) VALUES 'jirikrewinkel',
'jiriaesthetics@gmail.com', '29940b146d722a311446ca2d68f9739d', 0,
'd64a340bcb633f536d56e51874281454')