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 8910701
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:45:20+00:00 2026-06-15T03:45:20+00:00

For inserting strings into database, I apply this function on the string: $string =

  • 0

For inserting strings into database, I apply this function on the string:

$string = strip_tags($string);
$string = htmlspecialchars($string);
$string = preg_replace('/\s+/', ' ', $string); // removing multiple spaces :-)
$string = preg_replace('/(?:\s\s+|\n|\t)/', ' ', $string);
$string = mysql_real_escape_string($string);

On my localhost while I test the app, I enter: Life's Interesting

and the exact string saves into db (Life’s Interesting), then I uploaded my app on the real server, when I enter the same string, it saves: Life\'s Interesting in database!

Why is this happening on just the server and not on my local host? I’m using Wamp on my localhost. what configuration I need to change on the server so it saves right in db?

Thanks in advance

  • 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-06-15T03:45:22+00:00Added an answer on June 15, 2026 at 3:45 am

    Because magic_quotes_gpc

    var_dump(magic_quotes_gpc())
    

    var_dump magic quotes gpc in your both server. Your real server I think magic quotes is enabled by default.

    Magic Quotes is a process that automagically escapes incoming data to
    the PHP script. It’s preferred to code with magic quotes off and to
    instead escape the data at runtime, as needed.

    More to read PHP Manual – Magic Quotes

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

Sidebar

Related Questions

I am using mysql_real_escape_string function while inserting the data into MySQL database. I am
In my c# application i am inserting data into sqlite database as below String
I am inserting a group of strings into my table. This is a sample
I'm inserting some strings (that look dates) into a sqlite3 database via my ActiveRecord
The problem is with inserting json strings into MySQL database. In my python program
I got this very very frustrating error when inserting a certain string into my
I am having issues inserting this into my database I think tis when I
I am inserting smileys into strings. I have encoded the smileys in a certain
Currently, I'm simply inserting the word into the dictionary ( ArrayList<String> ) and then
When inserting a row in mysql database, string values need to be enclosed in

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.