Re: DBDO::get on a unique non-primary field.

From: Date: Fri, 22 Jul 2005 17:06:32 +0000
Subject: Re: DBDO::get on a unique non-primary field.
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20105@lists.php.net to get a copy of this message
On 7/22/05, Pupeno <pupeno@pupeno.com> wrote: > Hello, > I have a table with id, primary key with auto increment; > username; unique > key; etc. > I'd like to be able to do: > > $me->got($myusername); > > instead of having to do > > $me->whereAdd("username = > '$myusername'"); > $me->find(True); > > For that I added this directive to my configuration: > > 'sequence_Providers' => 'username' > > (Providers is the name of the table). > > Am I missing something ? > You almost never have to use whereAdd for simple things like this. To search on a field just do: $me->username = $myusername; $me->find(); However if you're only doing this on one field and you expect only one record you can still use get(). $me->get('username', $myusername); -- Justin Patrin

« previous php.pear.general (#20105) next »