简体   繁体   中英

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-"

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM