user2301515
user2301515

Reputation: 5117

mysqli_real_escape_string not work?

Can somebody know why mysqli doen't work in some servers?

$mysqli = mysqli_connect(DB_SERVER, DB_USER, DB_PASS, DB_DATABASE);
echo '-'.mysqli_real_escape_string($mysqli,"ab'c").'-';
mysqli_close($mysqli);

It display "--" insted of "-ab\'c-"

Upvotes: 0

Views: 80

Answers (1)

Hanky Panky
Hanky Panky

Reputation: 46900

There is only 1 possible explanation of this. Your connection failed to get established and $mysqli is not a valid MySQLi Resource.

var_dump($mysqli);

That will confirm this.

Upvotes: 1

Related Questions