php - Is this sql input validation secure?
Get the solution ↓↓↓Solution:
mysql_real_escape_string
uses whatever escaping mode is best, therefore it is fairly secure.
However, may I suggest an alternative. Why create a database class when there are several out there which utilize a much more secure method - Prepared statements. In a nutshell these work by separating SQL logic from user inputted data.
I would suggest using the PDO CLASS.
Also, you should really avoid using error suppression@
in PHP. As this tends to suppress errors which you might not even expect.
The following article is a fairly straightforward introduction to PDO.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: npm err! code 1
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.