You should properly escape value before put it in SQL:

'MATCH(SearchIndex.data) AGAINST('.
ConnectionManager::getDataSource($this->ModelName->useDbConfig)->value
($this->params['named']['search']).
') IN BOOLEAN MODE)'

On May 14, 6:50 am, Kyle Decot <[email protected]> wrote:
> Awesome! I thought when you used an array, you had to provide a key.
> Thanks Brian!
>
> On May 13, 7:41 pm, brian <[email protected]> wrote:
>
> > I meant that you can add it to the array, though as a string (ie. no key).
>
> > $conditions[] = 'MATCH(SearchIndex.data) AGAINST(\''
> >        . $this->params['named']['search']
> >        . '\') IN BOOLEAN MODE)';
>
> > On Wed, May 13, 2009 at 7:24 PM, Kyle Decot <[email protected]> wrote:
>
> > > Oh, my bad. I must have typed it incorrectly. They should all be
> > > $conditions; I'd rather do it in an array because I have a lot of
> > > different conditions/fields  that can go into the array. Is it
> > > possible to do MATCHES in an array?
>
> > > On May 13, 7:20 pm, brian <[email protected]> wrote:
> > >> You mention both $conditions & $criteria so it's a bit difficult to
> > >> say for sure. But that last bit would probably work better as one
> > >> complete string.
>
> > >> 'MATCH(SearchIndex.data) AGAINST(\''
> > >>         . $this->params['named']['search']
> > >>         . '\') IN BOOLEAN MODE)';
>
> > >> On Wed, May 13, 2009 at 6:37 PM, Kyle Decot <[email protected]> wrote:
>
> > >> > I am attempting to construct my array but am having some problems w/
> > >> > the $conditions array. I am doing something like:
>
> > >> > $conditions = array("Model.approved"=>1);
>
> > >> > if($something == $something_else)
> > >> > $conditions['Model.something'] = 1;
>
> > >> > if(!empty($search)) {
>
> > >> >        $criteria["MATCH(SearchIndex.data) "] = "AGAINST(" . 
> > >> > $this->params
> > >> > ['named']['search'] . "') IN BOOLEAN MODE)";
>
> > >> > }
>
> > >> > This is not making a valid mysql query. It's putting an equals sign
> > >> > right before the AGAINST part. How should I do this? Thanks
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to