为什么我在使用这个 mysqli_real_escape_string() 时一直收到这个错误?
mysqli_real_escape_string() expects exactly 2 parameters, 1 given in C:\xampp\htdocs\beatbeast\reg.php on line 6
我已经通过了连接,以及需要清理的字符串,但我怎么会一直收到这个错误?
这是我的代码
<?php
class Db_DatabaseUtilities{
public static function registerAccount($conn,$username,$password,$email){
if(!isset($conn)){
echo"XDDDDDDDDD";
}
$username = mysqli_real_escape_string($conn,$username);
$email =mysqli_real_escape_string($conn,$username);
$password = mysqli_real_escape_string($conn,$password);
$hashedpass = crypt($password,$username);
$sql = "INSERT INTO accounts ('username','password','email') VALUES('{$username}','{$hashedpass}','{$email}')";
Db_DatabaseUtilities::perform_query($conn, $sql);
}
public static function perform_query($conn,$sql){
$result_set = $conn->query($sql);
if(!$result_set){
die("Die Database Query Failed");
}else{
return $result_set;
}
}
}