I have a table called crs_desc with a data type of longtext. When I bring up this field in a form to be edited the text is surrounded by single quotes. For example:
'This is a bogus course for messing with'
Now, if I edit the text and delete the single quotes the text is updated with no problems. However, if I don't delete the single quotes, I get the following error message:
Error updating course 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 'This is a bogus course for messing with'' WHERE ID = '36'' at
Is there a way I can remove the single quotes before displaying the text for editing or is there another data type I should be using? I don't have to use longtext so I'm open for other datatypes. However, I don't want to limit the field to 255 char. because the course description may be longer than that.
BTW, when I display the field in an html document for just viewing, the single quotes are not displayed. It's only when its displayed in a form field that they appear.
Thanks for the help!
Problem with single quotes in mysql db
Moderator: General Moderators