Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to safely escape the input data in php for mysql [duplicate]

Tags:

php

mysql

Which means, at the moment, are the safest for screening data in php to send them to the mysql database.

Thank, you )

like image 681
frops Avatar asked Apr 30 '12 07:04

frops


1 Answers

I believe mysql_real_escape_string() mysqli_real_escape_string() is the best way to escape input data

Later edit since everything is deprecated now and information must be valid:

Try to use PDO as prepared statements are much safer or mysqli_*() functions if you really need to keep old code somewhat up-to-date.

like image 156
Mihai Iorga Avatar answered Oct 21 '22 18:10

Mihai Iorga