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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:06:54+00:00 2026-05-10T18:06:54+00:00

What are the dangerous characters that should be replaced in user input when the

  • 0

What are the dangerous characters that should be replaced in user input when the users’ input will be inserted in a MySQL query? I know about quotes, double quotes, \r and \n. Are there others?
(I don’t have the option of using a smart connector that accepts parameters so I have to build the query myself and this will be implemented in multiple programming languages, including some obscure ones so solutions such as mysql_real_escape_string in PHP are not valid)

  • 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. 2026-05-10T18:06:55+00:00Added an answer on May 10, 2026 at 6:06 pm

    mysql_real_escape_string() from mysql.com docs:

    The string in from is encoded to an escaped SQL string, taking into account the current character set of the connection. The result is placed in to and a terminating null byte is appended. Characters encoded are NUL (ASCII 0), “\n”, “\r”, “\”, “’”, “’”, and Control-Z (see Section 8.1, “Literal Values”). (Strictly speaking, MySQL requires only that backslash and the quote character used to quote the string in the query be escaped. This function quotes the other characters to make them easier to read in log files.)


    mysql_real_escape_string() is character set aware, so replicating all its abilities (especially against multi-byte attack issues) is not a small amount of work.

    From http://cognifty.com/blog.entry/id=6/addslashes_dont_call_it_a_comeback.html:

     AS = addslashes()   MRES = mysql_real_escape_string() ACS = addcslashes() //called with '\\\000\n\r'\'\032%_'  Feature                                         AS     MRES    ACS escapes quote, double quote, and backslash      yes    yes     yes escapes LIKE modifiers: underscore, percent     no     no      yes escapes with single quotes instead of backslash no     yes*1   no character-set aware                             no     yes*2   no prevents multi-byte attacks                     no     yes*3   no  
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What Unicode characters (more precisely codepoints) are dangerous and should be blacklisted and prohibited
I'm having problems with requests that include 'dangerous characters' as part of a Web
I have a form that is generated dynamically. The end users will be able
I need to be able to allow query strings that contain characters like '<'
I have a function that reads user input from std::cin, and I want to
A little knowledge can be a dangerous thing. Now that I've had a run
In the past I've heard that it can be dangerous to rename the Plone
I'd like to take user input, denoted as $dangerous_string , and use it as
I know regex is dangerous for validating IP addresses because of the different forms
I have a system which allows users to enter HTML-reserved characters into a text

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.