2012-01-14 54 views
-4

我无法弄清楚这个MySQL查询不起作用。MySQL查询不执行,是什么问题?

$add = mysql_query("INSERT INTO `members` (`id` ,`grade` ,`last` ,`first` ,`email` ,`schedule` ,`phone` ,`committees` ,`dues`) 
     VALUES (NULL , '$grade', '$last', '$first', '$email', '$schedule, '$phone', '$committees', '$dues' 
    )"); 

我得到这个错误:

Invalid query: 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, 'FBLA Week\nPartnership w/Business', '1')' at line 2

我无法看到的问题是与代码什么。有人有想法吗?

+3

你的脚本很容易出现的SQL注入。确保你清理你的输入! – TimWolla 2012-01-14 22:16:16

+0

@TimWolla我们不确定这一点,但总是提醒我们仔细检查一下。 – Wiseguy 2012-01-14 22:19:01

+0

@Wiseguy你说得对,但无论如何,你应该尽早对它进行清理,以免破坏任何不喜欢反斜杠的其他部分。 – TimWolla 2012-01-14 22:21:59

回答

3

您错过$schedule后的结束报价。

'$schedule, 
+0

啊!傻我。非常感谢! – 2012-01-14 22:15:00

2

您还没有关闭'压脚提升$schedule