Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4607632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T00:43:49+00:00 2026-05-22T00:43:49+00:00

I am using php5.3.6 and mysql 5.1.56 and CodeIgniter. Here is what I did.

  • 0

I am using php5.3.6 and mysql 5.1.56 and CodeIgniter. Here is what I did.

  1. Input some text in textarea, something like this:


    what’s this?

    I’m bob.


  2. $string = $_POST[‘name’];

  3. $insertdata = mysql_real_escape_string($string);

  4. Insert $insertdata into database.
    It shows “what\’s this?\n\n\nI\’m bob.”(without double quotes) in the table.

  5. Query the data stored in database, use stripslashes on it and then put it back to the textarea.
    It shows “what’s this?nnnI’m bob.”(without double quotes) in the textarea.

My questions are:

  • In step 4, shouldn’t it be “what\’s this?\n\n\n I\’m bob.” stored in the table?
    I checked php manual. It says:

mysql_real_escape_string() calls
MySQL’s library function
mysql_real_escape_string, which
prepends backslashes to the following
characters: \x00, \n, \r, \, ‘, ” and
\x1a.

  • How am I supposed to keep the textarea input format after using mysql_real_escape_string()?

  • Is there anyway to choose which slash to strip and which not to?

Notes:

  • magic quotes option is off
  • I did not use stripslashes() before
    using mysql_real_escape_string()
  • If I use addslashes() instead of
    mysql_real_escape_string(),
    everything works fine.
  • I don’ want to use addslashes() since
    it is not as secure as
    mysql_real_escape_string(), as far as
    I know.

Thanks,
Milo

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T00:43:50+00:00Added an answer on May 22, 2026 at 12:43 am

    This really does feel a lot like magic_quotes_gpc = On. Are you disabling it in php.ini or at runtime? It needs to be the former, otherwise it’ll remain on.

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

    The magic_quotes_gpc directive may only be disabled at the system level, and not at runtime. In otherwords, use of ini_set() is not an option.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using PHP5 to create XML files. I have code like this: $doc =
Using php5.2 and MySQL 4.1.22 I've come across something that, at first, appeared simple
Hey This is my login script, using PHP5 and MYSQLi, I just had help
Ok so I am trying create a login script, here I am using PHP5
PHP5.2.x back end. The text data transfer is using JSON objects. Am looking at
I'm used to web development using LAMP, PHP5, MySQL plus NetBeans with Xdebug. Now
I'm using PHP5 and MySQL. I'm using mysql_...() functions.
I am using PHP5 and MySql, I wondered if there was a way of
I was working on development environment containing PHP5 and Codeigniter using Apserve pack. I
Hi I'm new to php mysql development. I'm using wamp server on windows. php5.3.4,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.