mysqli_real_escape_string() expects exactly 2 parameters, 1 given
Documentation says it needs two parameters:
string mysqli_real_escape_string ( mysqli $link , string $escapestr )
The first one is a link for a mysqli instance, the second one is the string to escape.
Following is the proper format to use it :
string mysqli_real_escape_string ( mysqli $link , string $escapestr )
first parameter is mysql connection link identifier, and second is string For more details, you can visit this link : http://in2.php.net/manual/en/mysqli.real-escape-string.php.
Let me just add an extra bit of information: If you are using NetBeans, its documentation actually shows the mysqli_real_escape_string function like this:
mysqli_real_escape_string (PHP 5)
Escapes special characters in a string for use in an SQL statement, taking into account the current charset of the connection
Parameters:
string $escapestr
'The string to be escaped.'
Returns:
Type:
string
Description:
an escaped string.
This is wrong, though, as shown in the other answers. It requires both the $link and the $string.