Insert with PHP in SQL SERVER

Asked

Viewed 31 times

-1

Through the POST method I am sending the form data. However at the time of the insert INT type fields in the database give the following error:

"sqlsrv_rows_affected() expects Parameter 1 to be Resource, Boolean Given"

However, if I type the value in the variable for example: $cpf = '2345667' , instead of picking up track $cpf = $_POST['cpf'], i can realize the Insert. Some light?

$email = $_POST['email'];
$senha = $_POST['senha'];
$nome = $_POST['nome'];
$cpf = $_POST['cpf'];
$frase1 = $_POST['frase1'];
$frase2 = $_POST['frase2'];
$frase3 = $_POST['frase3'];

 if ($cpf == $cpfrm) {
  
  $sql = 'INSERT INTO tbl_termos (id, nome, cpf, senha, frase1, frase2, frase3, chapa, email) VALUES (?,?,?,?,?,?,?,?,?);';
  $params = ['00001', $nome, $cpf, $senha, $frase1, $frase2, $frase3, '99999', $email];
  $inserttermos = sqlsrv_query($conn, $sql, $params);  }
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.