我正在尝试为我的网站创建注册表单,但我的 sql 查询返回错误
$sql failed: 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 ''username','password','forename','surname','title') VALUES ('f','f','f','f','f')' at line 1
这是我在 signupaction.php 中的代码:
<?php
include('connect.php');
$username=$_POST["forename"];
$password=$_POST["surname"];
$forename=$_POST["username"];
$surname=$_POST["password"];
$title=$_POST["title"];
$sql = "INSERT INTO users ('username','password','forename','surname','title') VALUES ('$username','$password','$forename','$surname','$title')";
$result = mysql_query($sql, $link) or exit('$sql failed: '.mysql_error());
echo($result);
?>
我不知道为什么这不起作用,任何建议将不胜感激!谢谢!