Solved

MySql special characters

Posted on 2014-12-01
2
242 Views
Last Modified: 2014-12-01
Hi E's, I have a simple question about php and MySql:
When I send to the database words like "hello" "cars" etc, the database save that words, but when I use something like "don't" and other words with " ' " the database don't save.
What is the php function for resolve this problem?

The best regards, JC
0
Comment
Question by:Pedro Chagas
2 Comments
 
LVL 12

Accepted Solution

by:
tel2 earned 420 total points
ID: 40474914
Hi Pedro,

It would be helpful if you paste some code so we can see exactly, but I think this may be what you need:
    mysql_real_escape_string
http://php.net/manual/en/function.mysql-real-escape-string.php
0
 
LVL 58

Assisted Solution

by:Gary
Gary earned 80 total points
ID: 40474916
Depends on the library you are using and how you are inserting - you can escape the apostrophe in a string that is using apostrophes with the backslash e.g.

'some text with don\'t'

Open in new window

0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question