WARNINGS appear when INSERTING in a table with PHP

1

Good morning, when inserting a form with PHP if you insert the records in the database but it sends me the following WARNINGS:

  

Warning: Variable parameter 1 not passed by reference (prefaced with   an &). Variable parameters passed to sqlsrv_prepare or sqlsrv_query   should be passed by reference, not by value. For more information, see   sqlsrv_prepare or sqlsrv_query in the API Reference section of the   product documentation in C: \ xampp \ htdocs \ sana_php \ registry.php on   line 69

     

Warning: Variable parameter 2 not passed by reference (prefaced with   an &). Variable parameters passed to sqlsrv_prepare or sqlsrv_query   should be passed by reference, not by value. For more information, see   sqlsrv_prepare or sqlsrv_query in the API Reference section of the   product documentation in C: \ xampp \ htdocs \ sana_php \ registry.php on   line 69

     

Warning: Variable parameter 3 not passed by reference (prefaced with   an &). Variable parameters passed to sqlsrv_prepare or sqlsrv_query   should be passed by reference, not by value. For more information, see   sqlsrv_prepare or sqlsrv_query in the API Reference section of the   product documentation in C: \ xampp \ htdocs \ sana_php \ registry.php on   line 69

     

Warning: Variable parameter 4 not passed by reference (prefaced with   an &). Variable parameters passed to sqlsrv_prepare or sqlsrv_query   should be passed by reference, not by value. For more information, see   sqlsrv_prepare or sqlsrv_query in the API Reference section of the   product documentation in C: \ xampp \ htdocs \ sana_php \ registry.php on   line 69

The code I use is the following '

if ($errores == '') {
            $query=('INSERT INTO t_usuarios(nombre, usuario, correo, password) VALUES (?,?,?,?)');
            $statement=sqlsrv_prepare($conn, $query, array($nombre, $usuario, $mail, $pass));
            $resultado=sqlsrv_execute($statement);
        }

And the values I pass are those shown below:

$nombre=filter_var(strtolower($_POST['nombre']), FILTER_SANITIZE_STRING);
$usuario=filter_var(strtolower($_POST['usuario']), FILTER_SANITIZE_STRING);
#$usuario='gspindolab';
$mail=strtolower($_POST['mail']);
$pass=$_POST['pass'];
$pass2=$_POST['pass2'];
    
asked by Guillermo Ricardo Spindola Bri 16.05.2016 в 17:57
source

1 answer

4

What this warning is suggesting is that you should send the variables in that array as a reference, reading the official documentation your line of code should be as follows:

$statement=sqlsrv_prepare($conn, $query, array(&$nombre, &$usuario, &$mail, &$pass));

More information in the following link: link

    
answered by 16.05.2016 / 18:10
source