I have a long query return of which I need to use the current and next row to calculate some results. Can you do this without using fetch all?
I'm not sure how this is duplicate to my question ref to Your Common Sense
My question is PDO not mysql;
Example
| co1 1 | col2 |
| 1 | 444.44 |
| 2 | 666.66 |
| .... | ...... |
| 99999 | 111.11 |
IN PDO/PHP
$query = $pdo>query(sqlQuery);
while ($rs = $query->fetch(PDO::FETCH_OBJ)):
#NEED HELP HERE
if($rs->col2 //row2
>
$rs->col2 //row1
)
then{
do someting...
}
endwhile;
}
Hope that gives you an idea of what I want to do
thanks for your help