Nothing to do with cake. Your usage is incorrect.
Please review how to correctly build an 'OR' condition in the manual,
there are multiple examples.
On Nov 5, 2:45 pm, Nick <[EMAIL PROTECTED]> wrote:
> Yes, thats my biggest issue, I don't know if there is a way within
> Cake to define multiple array values for 'Question.content LIKE'
>
> I've tried building it like this, however the SQL query built off of
> this array isn't correct:
>
> $term = $this->data['Question']['searchTerm'];
> $splitTerms = explode(" ",$term);
> foreach($splitTerms as $splitTerm):
> $conditions['conditions']['OR']
> ['Question.content LIKE'][$i]= ("%
> $splitTerm%");
> $i++;
> endforeach;
> $this->set('questions',$this->Question->find('all',$conditions));
>
> On Nov 5, 2:38 pm, teknoid <[EMAIL PROTECTED]> wrote:
>
> > Seems like you are overriding your condition each time...
>
> > On Nov 5, 1:49 pm, Nick <[EMAIL PROTECTED]> wrote:
>
> > > I'm hoping someone can help. I'm fairly new to CakePHP but am
> > > thoroughly enjoying coding with it.
>
> > > Basically I've got a field within a table that contains my content.
> > > I'm trying to grab the search terms from a single input, explode them
> > > and search the content section for each term individually.
>
> > > I'm doing something along these lines:
>
> > > $term = $this->data['Question']['searchTerm'];
> > > $splitTerms = explode(" ",$term);
> > > foreach($splitTerms as $splitTerm):
> > >
> > > $conditions['conditions']['OR']['Question.content LIKE'] = array("%
> > > $splitTerm%");
> > > endforeach;
> > > $this->set('questions',$this->Question->find('all',$conditions));
>
> > > My dilemma is basically in setting the conditions... because
> > > 'Question.content LIKE' can only contain one value, I can't build an
> > > array within my foreach loop that I can then pass to the find method
> > > to build a full SQL query.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---