Solved

MySql special characters

Posted on 2014-12-01
2
235 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How can I run the php script or the page without visiting the page? 6 51
Form Processing in PHP 11 31
mysql update statement effect only some rows 4 26
php string masking 4 28
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now