Tags
PHP
Asked 7 years ago
6 Sep 2016
Views 2032
sarah

sarah posted

PHP Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.

i got this warning at error_log file at my server:



PHP Deprecated: mysql_escape_string(): This function is deprecated; use mysql_real_escape_string() instead.


all working perfect , but need to solve this
dilip

dilip
answered Nov 30 '-1 00:00

warning it self says that you using Deprecated function mysql_escape_string . instead you should use the mysql_real_escape_string

so suppose you are using now like this

$query="update user set `name`='".mysql_escape_string($name)."';

use instead

$query="update user set `name`='".mysql_real_escape_string($name)."';


above update example is not full well coded but i use it for explain your problem and solution .

mysql_escape_string() function was deprecated in PHP 4.3.0, and infact use MySQLi or PDO_MySQL extensions.



Post Answer