Solved

MySql special characters

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

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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Router for PHP reqeusts 12 33
fade new row in after record insert with jQuery/ajax/php 18 40
sql sentence 2 13
using hash in login 34 20
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

747 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

12 Experts available now in Live!

Get 1:1 Help Now