Re: fetchAll() for DB classes

From: Date: Wed, 28 Nov 2001 00:04:30 +0000
Subject: Re: fetchAll() for DB classes
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-3138@lists.php.net to get a copy of this message
"Richard Heyes" <richard@phpguru.org> wrote in message news:NEBBIDEMHHJJCANAAAKFMEKDJOAA.richard@phpguru.org... > > Maybe I'm missing something obvious, but how is that different from the > > existing getAll() ? > > It's not. I missed that one. Actually, one thing I frequently do when working with resultsets is the same as fetchAll() but with a specified key, typically an id field. So would it be possible to have a fetchAll($keyfield) function? Of course, the user would be responsible for the uniqueness of the key field... An example: given query: SELECT username, firstname, lastname FROM users; $users = fetchAll('username'); would result in something like: $users['andre'] => Array('username' => 'andre', 'firstname' => 'André', lastname => 'Næss); $users['foo'] => (Array containing data about foo) etc... André Næss

« previous php.pear.dev (#3138) next »