MySQL Forums
Forum List  »  Newbie

Re: Special Characters in Data Causing problems
Posted by: Phillip Ward
Date: February 12, 2019 06:06AM

You don't way what programming language you're using but I'm guessing you're building SQL on the fly.

Your best solution would be to read up on Parameterised Queries, which will take care of this (and Date formatting!) for you but, until then, you basically have to double-up the single quotes in any data value, something like this:

insert into table_name ( name ) values( 'Franklin''s Gard' );

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
Re: Special Characters in Data Causing problems
February 12, 2019 06:06AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.