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

  • Home
  • SEARCH
  • 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 8694891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:53:47+00:00 2026-06-13T00:53:47+00:00

Question, if you mysql_real_escape_string your variable, how can it still work with you SELECT

  • 0

Question, if you mysql_real_escape_string your variable, how can it still work with you SELECT SQL query. For example:

My row has a column that holds the value 's-Gravenmoer. Now The user types in 's-Gravenmoer and I will escape this entered value for safety. However, the row with the
colums that holds the value 's-Gravenmoer is never going to pop up, it added slahes
before the single quote. If there a way to do this with mysql_real_escape_string?

Thanks guys!
Sander

  • 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-13T00:53:51+00:00Added an answer on June 13, 2026 at 12:53 am

    You misunderstand the point of escaping data for SQL usage. It doesn’t permanently modify the data. Think of it as wrapping paper around a gift. You’re making a gift of some data to the database, and such you wrap it up nicely (real_escape_string). Once it reaches the database, the DB server unwraps the gift (removes the escaping) and puts the ‘gift’ into its stash.

    At no time would the backslashes you added EVER appear in the stored data, because they’re removed by the DB server as it’s doing the actual insertion. The escapes are there purely to ensure that whatever data you’ve inserted into the query do not “break” the SQL statement, e.g.

    $name = "Miles O'Brien"; // <---note the '
    $sql = "INSERT INTO people (names) VALUES ('$name')";
    

    resulting sql:

    INSERT INTO people (names) VALUES ('Miles O'Brien')
                                               ^--- oops, string terminated earlier, what's this "Brien" field/keyword?
    

    with real_escape_string, your query looks like

    ... VALUES ('Miles O\'Brien')
                        ^^---no longer an SQL string delimiter, treat it like any other char now.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Some people believe that mysql_real_escape_string() has some flaws and cannot protect your query even
Question 1 : Can I just use $userid = mysql_real_escape_string($_GET['user_id']); Or I need to
This question is related to my previous question - MySQL query to show records
My question is similar to this MySQL question, but intended for SQL Server: Is
Mysql query question How to count as 1 if is 1,2 or 5 for
I have a question about my mysql query. I want to count the number
The question I have is kind of simular to this one - MySQL select
There was a question about using stripslashes and mysql_real_escape_string on a password before hashing
Is there a Java equivalent to PHP's mysql_real_escape_string() ? This is to escape SQL
Okay so I'm looping through the results that contains two question IDs and two

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.