Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error when using single quotes in form fields

Status
Not open for further replies.

coben

Instructor
Apr 16, 2002
50
0
0
US
When I input information which contains a single quote, for example, "There wasn't a soul around", I get a MYSQL error stating:

Error updating certificate information: 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 't

I can input other non alpha-numeric characters and even double quotes, but unless I preceed the single quote with a \, then I get that error. I would prefer not to have to use the \ because other people will be updating information in the database.

I get the error regardless of whether I use the data type of varchar or mediumtext.

Is there a way I can configure MYSQL to allow input of single quotes without preceeding it with \?

Thanks.
 
No, you cannot. MySQL uses single quotes to delineate strings.

The best practice is to have in your appliation code which takes in put and escapes the slashes (changing "'" to "\'") before inserting the string into the database.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top