Will PDO laststatment-> fetchAll (PDO :: FETCH_COLUMN, column $) rerun the request for each call?

I am making a query that retrieves two fields.
I need each of these fields to be in a different array. Will it repeat the query for each call, or just repeat the result set?

$a= Laststatment->fetchAll(PDO::FETCH_COLUMN,0); $b= Laststatment->fetchAll(PDO::FETCH_COLUMN,1); 
+1
source share
1 answer

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.

0
source

All Articles