I created a record with a 58 data.
As I was creating, I was testing and the data was entering the DB, and every time an insert was made, I get the id
of the last set / data group entered.
But if I "refresh on the page" when I am going to make a new record, the data is no longer registered in the DB, it is as if the id
of the last record was lost, because I put echo
to show id
created and now I do not see more.
The error that happens is:
Array ([0] => Array ( [0] = > IMSSP [SQLSTATE] = > IMSSP [1] = > -14 [code] = > -14 [2] = > An invalid parameter was passed to sqlsrv_next_result. [message] = > An invalid parameter was passed to sqlsrv_next_result. )) 1
Can anyone tell me what might be happening?
$sqlProto = "INSERT INTO [RDO].[dbo].[Protocolo] (titulo, $transicaoCentralCorresp) VALUES (?,?)";
$sqlProto = "INSERT INTO [RDO].[dbo].[Protocolo] (titulo, $transicaoCentralCorresp) VALUES (?,?); SELECT SCOPE_IDENTITY() AS last_id ";
$paramsProto = array($titulo, $transicaoCentralCorresp);
$stmt = sqlsrv_query( $conn, $sqlProto, $paramsProto);
if($next_result){
$item = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC);
$uId = $item['last_id'];
echo "Último id inserido ". $uId."<br>";
}else{
die(print_r(sqlsrv_errors()));
}