What is the best practice for running mysql queries in php? Consider the risk of sql injection.



What is the best practice for running mysql queries in php? Consider the risk of sql injection...

Answer / Rishabh Pandey

The best practice for running MySQL queries in PHP to mitigate SQL injection risks is to use Prepared Statements or Parameterized Queries. This involves preparing a query with placeholders for variables and binding the variables separately, which helps prevent attackers from injecting malicious code into your queries.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

I created a cookie with the value like '1A2A',now i want to update this value regularly (about 20 times in a minute) with the value '1A2A3A' , 3A is the new value,new value will vary on the request it may be 3A or 4A or 100A ,some times the cookie is updating with new value but not every time.Can any body suggest the solution

1 Answers  


why did u want to leave your past organisation?

1 Answers  


how can we check mail function with '127.0.0.1' (before submitting a site?

1 Answers  


hey i m a trainee n jus wanted to ask that initially i was given the opportunity for .NET bt that project is abt to complete , nw i m asked to join a project of php on linux which is about to start , so wt say . is it a wise decision to join this project . will i be having job opportunities when i l complete my training after 4 months ? Plz suggest something ASAP .

1 Answers  


How to get useful error messages in php?

1 Answers  


What are the advantages of stored procedures, triggers, indexes in php?

1 Answers  


How can you declare the array in php?

1 Answers  


How to call javascript function in php without any event?

1 Answers  


When a conditional statement is ended with an endif?

1 Answers  


Explain what are psrs? Choose 1 and briefly describe it?

1 Answers  


Which is better python or php?

1 Answers  


How to merge values of two arrays into a single array?

1 Answers  


Categories