note 68989 rejected from function.odbc-fetch-array by betz

From: Date: Sat, 19 Aug 2006 08:33:14 +0000
Subject: note 68989 rejected from function.odbc-fetch-array by betz
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-116056@lists.php.net to get a copy of this message
Note Submitter: benson dot jin at clvgroup dot com ---- I use php 5.0 under IIS 6.0 (windows 2003), my page query Postgresql on a Redhat 9.0 (Linux) through windows odbc driver supplied by Postgresql. When I use odbc_fetch_array(), it has a very interesting behavior. Below is my code: =========================================== $query = "SELECT * FROM MyTable;"; $result = odbc_exec($db, $query) or die ("the query of {'$query'} failed!"); $numrows = odbc_num_rows($result); for ($n=0; $n<$numrows; $n++) { $eachrow = array_values(odbc_fetch_array ($result, 0)); print_r($eachrow); } ============================================ Note: I use "0" as int row number when do odbc_fetch_array(). If I use variable $n, I'll have the first one (which is row number 0 anyway) coming out properly. All rest will be blank. It seems that odbc_fetch_array() increases the point in the table after each fetch. Just a guess, don't take my word for it. Can anyone explain this myth? Benson

« previous php.notes (#116056) next »