yes. I did like this
$exploded_query = explode(" ", $this->query); if(count($exploded_query) > 1) { $k3=$k->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME,"%". $exploded_query[0]."%",Criteria::LIKE); $k3->addOr($k->getNewCriterion(sfGuardUserProfilePeer::LAST_NAME,"%". $exploded_query[1]."%",Criteria::LIKE)); $k1->addOr($k3); } On Oct 21, 4:21 pm, Gareth McCumskey <gmccums...@gmail.com> wrote: > You will of course need to have checks to make sure that $exploded_query[1] > exists before using it, my example was just a quick way to point you in the > right direction > > > > > > On Wed, Oct 21, 2009 at 9:45 AM, Avani <avani.v.puj...@gmail.com> wrote: > > > ya.. it's working > > > Thanks Gareth.. :) > > > On Oct 21, 12:12 pm, Gareth McCumskey <gmccums...@gmail.com> wrote: > > > $exploded_query = explode(" ", $this->query); > > > > $k->getNewCriterion( > > > sfGuardUserProfilePeer::FIRST_NAME,"%".$exploded_query[0]."%",Criteria::LIKE) > > > > $k->getNewCriterion( > > > sfGuardUserProfilePeer::LAST_NAME,"%".$exploded_query[1]."%",Criteria::LIKE) > > > > On Wed, Oct 21, 2009 at 5:25 AM, Avani <avani.v.puj...@gmail.com> wrote: > > > > > Hi > > > > > I have 1 table in my project, called "sf_guard_user_profile". In > > > > which, there are 2 fields, > > > > > 1. first_name > > > > 2. last_name > > > > > I m working on search module > > > > > in table, suppose there is 1 entry > > > > > firstname = 'John' > > > > lastname = 'Lee' > > > > > In search if any body searches for 'john lee', how to match ? > > > > > bcoz query should be like.. > > > > > first_name+' '+last_name = 'john lee' > > > > > If user searches for "john" or "lee" than I can display records, > > > > > $k->getNewCriterion(sfGuardUserProfilePeer::FIRST_NAME,"%".$this- > > > > >query."%",Criteria::LIKE) > > > > > $k->getNewCriterion(sfGuardUserProfilePeer::LAST_NAME,"%".$this- > > > > >query."%",Criteria::LIKE) > > > > > but I dont know how to write for 'first_name' + ' ' + 'last_name' > > > > > Pls help me... > > > > > Thanks. > > > > -- > > > Gareth McCumskeyhttp://garethmccumskey.blogspot.com > > > twitter: @garethmcc- Hide quoted text - > > > > - Show quoted text - > > -- > Gareth McCumskeyhttp://garethmccumskey.blogspot.com > twitter: @garethmcc- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---