I'm using something like the following PHP code to put all data from a query into an array:
<?php
$results = array();
$q = odbc_exec("SELECT * FROM table");
while ($row = odbc_fetch_array($q)) {
$results[] = $row;
}
?>
This works fine, but it is very slow when the query contains thousands of rows.
My question is, is there any way in PHP to dump all the data into an array without having to loop through each record one by one?
NOTE: Using MS SQL Server for the database.
whileloop itself, if you don't need to rely on the array any further.