我试图修复这个查询,但由于某种原因,它抛出错误。我应该做什么改变?
$statement=$conn->prepare("SELECT p.productid AS productid,
p.productname AS productname,
t.itemid AS itemid,t.amount AS amount,
t.is_completed AS is_completed,
t.id AS recordid
FROM products p,temporder t
where p.productid=t.itemid AND is_completed = 0
LIMIT 0, 30 AND t.email = ?");
$statement->execute(array($_SESSION['email']));
$rows=$statement->rowCount();//get no. of rows
$statement->setFetchMode(PDO::FETCH_ASSOC);
错误:
SQLSTATE[42000]: Syntax error or access violation: 1064SQL语法错误;请查阅与您的产品相对应的手册MySQL服务器版本的正确语法使用附近的'AND .email ='test@gmail.com "
change this
where p.productid=t.itemid AND is_completed = 0 LIMIT 0, 30 AND t.email = ?
where p.productid=t.itemid AND is_completed = 0 AND t.email = ? LIMIT 0, 30