select子句中的MYSQL错误1064

时间:2014-04-09 06:38:47

标签: php sql

由于我是初学者所以我在此查询中遇到语法错误。

$SQL = "SELECT * FROM registration WHERE email = ".$email." AND password = ".$password."";

6 个答案:

答案 0 :(得分:4)

您的查询语法有误。尝试将其更改为

$SQL = "SELECT * FROM registration WHERE email='".$email."' AND password='".$password."'";

答案 1 :(得分:1)

将单引号添加到值字段

$SQL = "SELECT * FROM registration
           WHERE email = '".$email."' AND password ='".$password."'";

答案 2 :(得分:1)

你应该在变量之前和之后加上单引号。

$SQL = "SELECT * FROM registration WHERE email = '".$email."' AND password = '".$password."'";

答案 3 :(得分:0)

$SQL = "SELECT * FROM registration WHERE email='$email' AND password='$password'";

试试这个..

答案 4 :(得分:0)

您传递的是字符串,字符串应该用单引号括起来。试试这个 -

$SQL = "SELECT * FROM registration WHERE email = '".$email."' AND password = '".$password."'";

答案 5 :(得分:0)

请尝试这个,你应该使用单引号。

$SQL = "SELECT * FROM registration WHERE email = '".$email."' AND password = '".$password."'";