I am fetching the results from a db with PDO::FETCH_ASSOC. The issue is that I am doing it twice in the same file. Is that a known issue? What would be the alternative?
Here is my code:
FIRST TIME
while($row = $ordersQuery->fetch(PDO::FETCH_ASSOC))
{
$totalAmount += $row['clientPrice']/100;
}
echo $totalAmount;
SECOND TIME
while($row = $ordersQuery->fetch(PDO::FETCH_ASSOC))
{
....
}
Whenever I remove the first fetching, the second works fine. If I have both, the second does not return anything.
Thanks!