0
I have a query and would like to access the first line without using sqlsrv_fetch_array, because this function already jumps to the next line and I would not like it to occur.
$resultado = sqlsrv_query($conexao98, $query, $params, $options) or die(print_r(sqlsrv_errors()));
I want to recover the first field of the first line of "$result" without this line being lost.
Every time you extract a line from the result set it is removed. I think there is another way to solve this, I just don’t quite understand what the problem is.
– rray
good, it’s just that I need to catch a field before I enter my loop to display the lines, only if I use it the first line gets lost
– V.Avancini
would like to know how to extract without removing
– V.Avancini
your result comes as? has how you insert an example?
– Diego Braga
@Diegobraga just want to access the $result without removing the accessed line
– V.Avancini
If the result set is not extracted your while goes into infinite loop. I imagine something like
$valido = false; $primeiraLinha = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC); if($primeiraLinha ...){ $valido = true} while($row = sqlsrv.....){ if($valido) { executado algo } else{ executa outra coisa} }
– rray