The $conditions I specify above create the following sql bit: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND (`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat %') AND (`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%')
I believe that what I need would be this: WHERE NOT (`Listing`.`expiration` BETWEEN '1' AND '1180232564') AND ((`Listing`.`title` LIKE '%cat%') OR (`Listing`.`description` LIKE '%cat%')) AND ((`Listing`.`title` LIKE '%dog%') OR (`Listing`.`description` LIKE '%dog%')) Note the extra parenthesis, creating the logic "X and (A or B) and (M or N)". How do I create groups like this? Thanks again for your expertise! On May 25, 4:02 am, AD7six <[EMAIL PROTECTED]> wrote: > On May 24, 10:21 pm, squidliberty <[EMAIL PROTECTED]> wrote: > > > > > Fabulous! That works perfectly for most of my queries. But why won't > > it work in the following? > > > $conditions['NOT'] = array('Listing.expiration' => "BETWEEN 1 AND > > ".mktime()); > > $conditions[0]['OR'] = array("Listing.title" => "LIKE %".$term."%", > > "Listing.description" => "LIKE > > %".$term."%"); > > $conditions[1]['OR'] = array("Listing.title" => "LIKE %".$term_2."%", > > "Listing.description" => "LIKE > > %".$term_2."%"); > > > Based on the examples given in other discussions, I'd expect this to > > return all listings between the timestamps given that include both > > term 1 and term 2 in either the title or description. But instead, the > > expiration requirement is ignored entirely. > > What sql is that generating, and what sql do you need to get it to > work as you want. > > http://www.google.com/search?q=online+sql+format+http://bin.cakephp.org > = readable output. > > hth, > > AD --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---