开发者

How can i debug this SQL error..?

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server versi开发者_如何学Pythonon for the right syntax to use near 'Krul. Good bye!.')' at line 1

I have a LONG script with a lot of loops. It seems to work and then I get thsi error, what does it mean?

Update: Oh okay, I see what's wrong. I am storing a variable that sometimes have an apostrophe in it, so it messes up my SQL syntax. e.g. $name = "You and D'dog are cool." my sql syntax would be like this '$name'

How can I fix this?

Update 2: I am using addslashes()


It means you have a syntax error there, most likely an unescaped string with a apostrophe. It's not possible to help better without seeing the script.

EDIT: Don't use addslashes(), use a function that is designed for escaping SQL queries. In your cases that would be mysql_real_escape_string().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜