哪里喜欢MySQL错误

时间:2014-04-12 17:20:20

标签: mysql variables where sql-like

我正在尝试在php和mysql中进行LIKE查询,但我一直收到错误。有谁知道答案?

 $addedquery = "WHERE name LIKE '%".$keyword."%'";

You have an error in your SQL syntax; check the manual that corresponds to your MySQL `enter code here`server version for the right syntax to use near 'WHERE name LIKE '%%'' at line 1

完整代码: http://pastebin.com/PbNyBaaP

1 个答案:

答案 0 :(得分:1)

这是您的完整查询吗?你错过了首发:

$addedquery = "SELECT * FROM table WHERE name LIKE '%".$keyword."%'";