Jump to content

using quotation marks with php and mysql


jobs1109

Recommended Posts

Hi everyone,

 

I am having a problem with using quotation marks / apostrophe with php and mysql. If I enter the following lines in mysql.

 

"user's resume"  when I do a query from mysql i get back " User\'s resume" it's adding a slash before  the

apostrophe. How can I fix this ?

 

Thanks.

You state that you are getting the slash on the returned data. I think your problem is that you are probably using mysql_real_escape_string() (or possibly addslashes()). But the problem is that your server probably has magic quotes enabled. So, when you send data through POST/GET/COOKIE the server is automatically adding slashes. So, when you then run the input through mysql_real_escape_string() it is escaping the slashes to make them part of the data.

 

Magic quotes are deprecated and should be disabled. If you cannot disable them through the ini file, then you should add code to dynamically remove them at run time.

 

http://php.net/manual/en/security.magicquotes.disabling.php

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.