Я получаю WARNINGS при вставке в таблицу с PHP


Доброе утро, при вставке в форму с PHP, если вы вставляете записи в базу данных, но бросаете мне следующие WARNINGS:

Warning: переменная parameter 1 not passed by reference (prefaced with Ан &). Переменная 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\registro.php on line 69

Warning: переменная parameter 2 not passed by reference (prefaced with Ан &). Переменная 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\registro.php on line 69

Warning: переменная parameter 3 not passed by reference (prefaced with Ан &). Переменная 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\registro.php on line 69

Warning: переменная parameter 4 not passed by reference (prefaced with Ан &). Переменная 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\registro.php on line 69

код, который я использую, выглядит следующим образом '

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);
        }

и значения, которые я передаю, показаны ниже:

$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'];
Author: Juan Pinzón, 2016-05-16

1 answers

То, что предлагает вам это предупреждение, заключается в том, что вы должны отправить переменные в этом массиве в качестве ссылки, читая официальную документацию ваша строка кода должна быть следующей:

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

Дополнительная информация по следующей ссылке: https://msdn.microsoft.com/es-ec/library/cc296181 (v=sql.105).aspx

 4
Author: Juan Pinzón, 2016-05-16 16:57:31