I'm a beginner in PHP and I only know some basic things. Months ago, I started working on a "blog" platform, and created a login system based on PHP and MySQL. To make it more secure, I encrypted the passwords and used mysqli_real_escape_string()
on the variables present in the login form ($username
, $password
).
I read something about some kind of "prepared statements", and I've got a question: why are they considered "better" than mysqli_real_escape_string()
? Why should I use them, instead of the function mentioned above?
Looked for an answer, and didn't find any (only people that constantly said that it is 'just better'), so I decided to ask the question here.