I am using PHP version 5.3 and trying to use mysql_real_escape_string($unescaped_string) in my code, but I get the error:
Fatal error: Call to undefined function mysql_real_escape_string()
in /var/www/engine/database.php on line 38
I can still connect to the database however. Why is it not available?
I am using PHP version 5.3.
Update as mentioned in comment,
mysql_has been deprecated since 5.5:and removed in PHP 7.
mysql_real_escape_string()is standard part of MySQL function “batch” and should always work if the extension is loaded correctly.Does any another
mysql_function work? (It should not)Make sure, that you have this line uncommented in your
php.ini:Also it’d be wise to use
mysqliorPDOinstead (mysql_is deprecated), they both can take care of escaping for you.