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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:44:53+00:00 2026-05-29T05:44:53+00:00

while i understand why mysql_real_escape_string requires an active mysql connection to escape various strings,

  • 0

while i understand why mysql_real_escape_string requires an active mysql connection to escape various strings, i were hoping on the following:

some sort of way to manually (er, terminology here, perhaps ‘statically’ would be the correct term) push the charset to mysql_real_escape_string so that no active db connection is required to run mysql_real_escape_string.

as some people may ask why we want to mysql_real_escape_string without an active connection, the reasoning is simple:

a) construct query (this is where the mysql_real_escape_string takes place)
b) create hash (md5, md4, sha1, crc32, choose your poison) from said query
c) check cache (memcached) for hash created in step b
d) query cached in memcached -> return cached results -> terminate script
c) query NOT cached in memcached -> connect to mysql -> cache result to memcached + return result

so as you can see with the above, because a hash of the query is created prior to checking the cache / connecting to the db if needed… mysql_real_escape_string takes place BEFORE a db connection is made.

the whole goal of this is so that if we are able to execute a ‘whole page request’ purely from cache hits, there is just no need to connect to mysqld. period.

what we have now is a large set of requests where the a db connection is made just so that mysql_real_escape_string can execute. this seams un necessary.

so, to summarize:

we need to a way to SAFELY escape mysql strings (POST and GET values, so it needs to be 100% safe) without making a db connection.

thanks.

  • 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-29T05:44:54+00:00Added an answer on May 29, 2026 at 5:44 am

    I’d suggest a different approach:

    function search(array $params) {
        $cacheKey = md5(serialize($params));
    
        ... search cache ...
    
    }
    

    You don’t need to run the hash on the query, you can just run it on the supplied parameters. The query would supposedly be the same every time.

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

Sidebar

Related Questions

I've been learnging php/mysql for a short while and I got some basic stuff
While I understand this question is fairly vague since I'm not giving you all
While I understand what simulation and emulation mean in general, I almost always get
I new to Scrum and while I understand the team concept behind the Sprints,
I am pondering about partial specialization . While I understand the idea, I haven't
Jeff Atwood wrote about this here , and while I understand the theoretical performance
How do I find a stored procedure containing a certain text? While I understand
Autoboxing is rather scary. While I fully understand the difference between == and .equals
I'm trying to understand how a while loop looks in IL. I have written
While HTML Scraping is pretty well-documented from what I can see, and I understand

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.