user880789 user880789 - 6 months ago 25
SQL Question

PHP Error: Mysqli_real_escape_string() expects exactly 2 parameters, 1 given

if (phpversion() >= '4.3.0'){
$string = mysqli_real_escape_string($string);
}else{
$string = mysqli_escape_string($string);
}


All the documentation for
mysqli_real_escape_string
seems to indicate this is a valid bit of code - don't understand?

Answer

Documentation saying 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.