Jump to content

mysql_real_escape_string


c_pattle

Recommended Posts

I have a form that allows users to submit to a database and for security reasons I am using mysql_real_scape_string on all of their input values.  However this means that if the user puts something in speech marks such as

 

"hello"

 

It will then show up in the database as

 

\"hello\"

 

This means that whenever I fetch anything from the database it will have slashes in which doesn't look good.  How do other people get round this problem.  When I fetch something from my database should I do a string replace and just delete these slashes or is there a better method?

 

Thanks for any help. 

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

 

 

Thanks, I don't think I'm escaping the fields twice.  I've copied below my code.  Am I escaping it twice?

 

$submit_sql = sprintf("insert into reviews (review_name, review_content, review_summary) values (\"%s\", \"%s\", \"%s\")", mysql_real_escape_string($_GET['submit_film_name']), mysql_real_escape_string($_GET['submit_film_content']), mysql_real_escape_string($_GET['submit_film_summary']));

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.