mysqli_real_escape_string - I do not know what is recorded in the bbdd

1

As a good student, I have a question about the function     mysqli_real_escape_string

My code:

$connn=mysqli_connect("localhost","root","", "test");
1// Obtenemos los datos del formulario, asegurándonos que son válidos.
        $usuario=mysqli_real_escape_string($connn, $_POST['usuario']);
        //$usuario=mysqli_real_escape_string($db, $usuario);
        echo "usuario: $usuario </br>";

Well, it's not complete, but it's long. My question is two.

  • I had to generate a variable "$ connn" again in order to set the parameter "$ link" . I do not know why when I file it already has an include with "conexion.php". Where it is declared but not caught.

  • What data do you record in the BD? For example, if I put "user2525" I guess I will be recorded in the bd "" user2525 " since it has no character to escape, but if for example I put " user / 25 ", should I record " user25 ", that is, without the characters, since only the string escapes? The truth is that it does not work for me:: (

  • Thanks friends.

        
    asked by Eva MV 17.08.2018 в 19:15
    source

    1 answer

    0

    According to PHP's documentation in Spanish about mysqli_real_escape_string :

      

    The encoded characters are NUL (ASCII 0), \ n, \ r, \, ', ", and Control-Z.

    The diagonal / is not encoded.

    link

        
    answered by 17.08.2018 / 19:33
    source