Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given… what i do wrong?

前端 未结 11 839
[愿得一人]
[愿得一人] 2020-11-28 12:52

I try make php login but i get this error: Warning: mysqli_real_escape_string() expects exactly 2 parameters, 1 given, what I do wrong?

register.php

11条回答
  •  醉酒成梦
    2020-11-28 13:13

    mysqli_real_escape_string function requires the connection to your database.

    $username = mysqli_real_escape_string($your_connection, $_POST['username']);
    

    P.S.: Do not mix mysql_ functions* and mysqli_ functions*. Please use mysqli_* functions or PDO because mysql_* functions are deprecated and will be removed in the future.

提交回复
热议问题