note 95764 modified in function.odbc-fetch-array by danbrown
| From: | danbrown@php.net | Date: | Thu, 21 Jan 2010 01:48:20 +0000 |
| Subject: | note 95764 modified in function.odbc-fetch-array by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165148@lists.php.net to get a copy of this message | ||
In trying to execute queries and looping through the results like so...
<?php
while( odbc_fetch_row( $myResultID ) )
{
$myRow = odbc_fetch_array( $myResultID );
$thisResult[ $myRow[ "column" ] ] = $myRow;
}
?>
...I found that not only was my first row being skipped, but also every OTHER row was being skipped,
thus a known result set containing 14 rows would dwindle down to 7.
My solution is as follows as I needed to return an array of rows:
<?php
while( $myRow = odbc_fetch_array( $myResultID ) )
{
$thisResult[ $myRow[ "column" ] ] = $myRow;
}
?>
--was--
In trying to execute queries and looping through the results like so...
while( odbc_fetch_row( $myResultID ) )
{
$myRow = odbc_fetch_array( $myResultID );
$thisResult[ $myRow[ "column" ] ] = $myRow;
}
...I found that not only was my first row being skipped, but also every OTHER row was being skipped,
thus a known result set containing 14 rows would dwindle down to 7.
My solution is as follows as I needed to return an array of rows:
while( $myRow = odbc_fetch_array( $myResultID ) )
{
$thisResult[ $myRow[ "column" ] ] = $myRow;
}
http://php.net/manual/en/function.odbc-fetch-array.php