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

前端 未结 11 838
[愿得一人]
[愿得一人] 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:14

    From the documentation , the function mysqli_real_escape_string() has two parameters.

    string mysqli_real_escape_string ( mysqli $link , string $escapestr ).
    

    The first one is a link for a mysqli instance (database connection object), the second one is the string to escape. So your code should be like :

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

提交回复
热议问题