note 68989 added to function.odbc-fetch-array

From: Date: Fri, 18 Aug 2006 13:54:50 +0000
Subject: note 68989 added to function.odbc-fetch-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-116039@lists.php.net to get a copy of this message
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 ---- Server IP: 216.235.15.211 Probable Submitter: 206.191.24.166 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.odbc-fetch-array.php Edit -- https://master.php.net/note/edit/68989 Del: integrated -- https://master.php.net/note/delete/68989/integrated Del: useless -- https://master.php.net/note/delete/68989/useless Del: bad code -- https://master.php.net/note/delete/68989/bad+code Del: spam -- https://master.php.net/note/delete/68989/spam Del: non-english -- https://master.php.net/note/delete/68989/non-english Del: in docs -- https://master.php.net/note/delete/68989/in+docs Del: other reasons-- https://master.php.net/note/delete/68989 Reject -- https://master.php.net/note/reject/68989 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116039) next »