Jump to content

entering data in the db


jimfog

Recommended Posts

When I put data into the db I always use the real_escape_string function for security purposes. Is there a need to do something similar when I SELECT data from the db? Are there any security issues to consider in the above scenario?

Link to comment
Share on other sites

mysql_real_escape_string for an insert query isn't really about security, it's about making sure the data gets inserted accurately. As far as security goes when you're dealing with displaying user-submitted data, that's part of what OWASP is about: https://www.owasp.org/index.php/Main_Pagehttps://www.owasp.org/index.php/Cheat_Sheets

Link to comment
Share on other sites

  • 2 weeks later...

Is it correct to pass mysql_real_escape_string to variable like$year =mysql_real_escape_string( trim($_POST['year'])); or correct to use it in query like bellow$year =( trim($_POST['year'])); $sql = "INSERT INTO table (year) values ( . mysql_real_escape_string($value) .)

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...