$search_condtions = array(); if ( !empty($conditions['Equipment']['incharge']) ){ $search_condtions['Equipment.incharge'] = $conditions['Equipment'] ['incharge']; } ... etc for other fields $this->set('results', $this->Equipment->findAll( $conditions );
On Jul 9, 5:19 pm, hashkash <[EMAIL PROTECTED]> wrote: > Hi! > I searched the group for my problem but in vain. Sorry if this > is redundant. > I have created a search form having 4 fields to be filled up. I would > like to base my search only on fields that have been filled up.With my > current findall() Im not able to do so. > How do I build the array string based on filled up fields? > I have assigned a buildsearch value i.e if the field is entered = 1 > else = 0.In regular PHP i can create a buildsearchstring function but > with cake Im unable to figure out how to do so. > > This is my findall() > > $this->set('results', > $this->Equipment->findAll(array('Equipment.owner'=>$conditions['Equipment'] > > ['owner'],'Equipment.incharge'=>$conditions['Equipment'] > ['incharge'],'Equipment.eqno'=>$conditions['Equipment'] > ['eqno'],'Equipment.type'=>$conditions['Equipment'] > ['type']),'',"Equipment.owner ASC",'','',0)); > > Hoping for some help! > Thanks! > Kashyap --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---