Reply to Problem with apostrophe in MySQL

Your name:

Reply:


Posted by J. Cairn on 04/09/07 22:08

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.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация