Solved

MySql special characters

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.

810 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