quote($word, NULL, true); $word = substr($word, 1, strlen($word)-2); $sql .= ' ( '; foreach ($filterFields as $field){ $sql .= $field . " {$equation} '%{$word}%' {$rule} "; } $sql = substr($sql, 0, -4); $sql .= ' ) AND '; } $sql = substr($sql, 0, -5); if ($sql){ $sql = ' AND '.$sql; } return $sql; } function getWords($query) { preg_match_all('/"([^"]*)"/', $query, $res); $query = str_replace($res[0], '', $query); $words = explode(' ', ' '.$query); $words = array_merge($words, $res[1]); $words = array_unique($words); unset($words[0]); return $words; } } ?>