I have always worked with ASP connections using ADODB and navigating the logs that the query returned to me was not a problem since they were:
<%
rs.movenext //anda para proxima linha do retorno da query
rs.moveprevious //anda para linha anterior do retorno da query
rs.movefirst //anda para a primeira linha do retorno da query
rs.movelast //anda para a ultima linha do retorno da query
%>
More information on these commands here .
I'm having trouble navigating the records in my PHP query using PDO. I have not found something that is equivalent to these commands mentioned above.
Let's say I have a foreach
to go through a query, but inside each loop I need to check if the next record is the last record to add some more information to this current loop ... how to do it?
<?php
$sql = "Select * From Tabela";
$sql = $db->prepare($sql_pai);
$sql->execute();
if($sql->rowCount() > 0){
foreach($sql as $rs){
echo $rs["nome"];
//VERIFICAR SE O PROXIMO É O ULTIMO PARA ADICIONAR MAIS INFO
}
}
?>