MySQL Forums
Forum List  »  Newbie

Re: Special Characters Support?
Posted by: Phillip Ward
Date: December 03, 2014 06:24AM

The apostrophe is not a Special Character, but it is significant to MySQL (and most other databases) in that it delimits character data and strings).
With MySQL, you have to "double-up" the apostrophe to get it through ...

insert 
into table1( name ) 
values ( 'Amanda''s' ),( 'Chocolate''s' ) ;

... or, better still, use the escaping function(s) in your application language (mysqli_real_escape_string is one such) or use parameterised queries; both of these will handle this "doubling-up" for you and will also give you [some] protection against SQL Injection attacks.

Regards, Phill W.

Options: ReplyQuote


Subject
Written By
Posted
December 02, 2014 10:55PM
Re: Special Characters Support?
December 03, 2014 06:24AM


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.