I cannot use mysql_* functions after upgrading PHP

mysqli_real_escape_string needs two arguments to work:

Syntax:

mysqli_real_escape_string($connection,$escapestring);

You need to give it the connection variable. This looks like

$connection=mysqli_connect("host","my_user","my_password","my_db");

You should refresh your PHP knowledge.

An alternative method would be to use a database object so you don’t have to pass in the connection details each time.

Leave a Comment