As shown in the PHP manual:
The procedural style for this function requires a mysqli instance, in other words, a connection to the database previously created (This may be oversimplifying):
string mysqli_real_escape_string ( mysqli $link , string $escapestr )
In order to call this function without the first parameter you need to instanciate the mysqli class, hence providing the function with the connection without really adding any other parameter. This is how the class is instanciated:
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
And this would be the way to call the function in an object oriented manner:
$string = $mysqli->real_escape_string($string);
Hope this clarifies a bit your question.