Hi Dave, Maybe not the nicest solution, but this should work:
$i=0; // This is your counter // Now build your SQL String $sql = "SELECT * FROM table"; foreach ($string as $key => $value) { $value = trim($value); //strip white space befor and after each term // $value = trim($string[$i]); $sql.= "Post.title LIKE '%" . $value. "%' OR Post.description LIKE '%" . $value . "%' "; $i++; // Put your counter up by 1 if($i < count($string)) // Check if your counter is smaller than amount of values in array, if there are still values, add a OR { $sql.="OR"; } } You can try out by putting in echo $sql at the end. Is this what you were looking for or did I missunderstood? Luke --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---