Option 3: it will not repeat over the set of results, since everything has already been selected, and the second call returns an empty array (at least here it is).
$a = array(); $b = array(); while($r = $laststatement->fetch(PDO::FETCH_NUM)){ $a[] = $r[0]; $b[] = $r[1]; }
That is: with MySQL there is no scrollable cursor, I did not try to use another database with the PDO :: CURSOR_SCROLL capability.
source share