Jump to content

mysql_real_escape_string


lillyapps

Recommended Posts

Hello everyone.  This is my first post and I'm excited about using this forum.

 

So, what I'm trying to do is be pro-active in reguards to limiting SQL Injection with my new web application and learned that I should be using the mysql_real_escape_string() function.  What I belive is happening is that backslashes are being inserted for my quotes and apostrophes within my query string.  This sounds fine except for the SQL INSERTs and UPDATEs.  The backslashes are being included when writing to the database.

 

Example:  If I have a database field named myField and insert the string value: This is a "test" value

It is getting stored in my database as: This is a \"test\" value

 

I plan to do more testing tonight but thought I'd ask here first.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/104433-mysql_real_escape_string/
Share on other sites

rhodesa, it was Magic Quotes but I was looking in the wrong place.  When I escape a string in javascript and pass it, the _GET translates the HEX values (which I like) but it also inserts backslashes where ever there was a quote.  I added stripslashes() if Magic Quotes is ON when reading _GET and that fixed it.

 

Thanks for you help.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.