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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.