Re: Re: put data into array

From: Date: Tue, 17 Jun 2003 00:55:59 +0000
Subject: Re: Re: put data into array
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-151763@lists.php.net to get a copy of this message
>I have problem when I try to retrieval the data from Oracle database. >what I want is to put each row of data into an array with second column >value as the key and first column as the value, at present I can not >append the value to the existing array instead replacing current array >value, can any people how can I fix it , sorry I am pretty new to PHP, >thank you in advance. Each time you iterate through the while loop, you are overwriting your old results with new ones. Try something like the following (note the '[]' near the end): $results = array(); while(ora_fetch_into($cursor, $result, ORA_FETCHINTO_ASSOC)) if(is_array($result)) $results[] = $result; print_r($results) Read more in "square bracket syntax" at http://www.php.net/manual/en/language.types.array.php --------------------------------------------------------------------- michal migurski- contact info and pgp key: sf/ca http://mike.teczno.com/contact.html

« previous php.general (#151763) next »