我正在尝试将电子邮件地址保存到我的数据库中,但出现以下错误
include 'db.php';
echo $email = $accounts['username'];
$date = date ("Y-m-d H:m:s");
$result = mysql_query("SELECT * FROM users where email = $email", $conn) or die($myQuery."<br/><br/>".mysql_error());
$num_rows = mysql_num_rows($result);
if ($num_rows == 0) {
$query_string = "INSERT INTO users (id, email, created)
VALUES (null, '$email', '$date')";
if (mysql_query($query_string, $conn)) {
echo "$name inserted<br/>";
} else {
die('Error: ' . mysql_error());
echo "Error inserting $email<br/>";
}
} else {
echo "$email exists<br/>";
}
错误:
您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 1 行的“@mink7.com”附近使用正确的语法