|
Posted by Tyno Gendo on 04/09/07 22:44
J. Cairn wrote:
> I have a form that updates a MySQL database. Standard stuff. But when
> my data has a comma, I get this error:
>
> "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 's'' at line 1"
>
> But it's not what you are thinking. I have handled the apostrophe
> every way I can think of. I have used addslashes, I have replaced '
> with \' etc. I still get the error.
>
> What's odd is that, despite the error, the data does go into the
> database correctly. Also, when I echo the SQL statement to the page,
> copy it and paste it directly into MySQL, it works fine with no
> errors. And for what it's worth, when I put an escape directly in the
> form field (e.g. I type Shane\'s) it works fine.
>
> I'm using PHP 4.4.4 on a shared server. I don't know what version of
> MySQL they are running.
>
> Any ideas? Thanks in advance.
>
Can you please supply copy of code?
Have you tried mysql_real_escape_string ??
Navigation:
[Reply to this message]
|