Jump to content

Recommended Posts

I have a database manager script that I am working on, kind of like phpmyadmin. When a user types in their custom query, it automatically escapes semi quotes.

 

example:

User inputted query: 
SELECT * FROM users WHERE username='Joe';

What php does:
SELECT * FROM users WHERE username=\'Joe\';

 

Is there anyway to make php not do this?

Link to comment
https://forums.phpfreaks.com/topic/146924-solved-php-auto-escaping-mysql-strings/
Share on other sites

You are over escaping the data.

 

Check that magic_quotes is turned off, if not turn it off. You may have to stripslashes on current data then update it for it to be right in the current DB.

 

Basically with magic_quotes on, php adds addslashes to any form data passed to the script. It is being depreciated/turned off in PHP 6. So I suggest not relying on it and just turn it off and be happy :)

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.