
Лучший Ответ CB9TOIIIA , 30 July 2015 - 12:47
Поэкспериментировал, пока склоняюсь к этому варианту:
if ($search) { $searchData = explode(' ', $search); $searchWhere = array(); $from .= ' LEFT JOIN ' . ZOO_TABLE_SEARCH . ' AS s ON a.id = s.item_id'; foreach ($searchData as $searchWord) { $searchWord = JString::trim($searchWord); $searchWhere[] = implode(' OR ', array( // 'LOWER(a.name) REGEXP ' . $this->db->Quote('^' . $this->db->escape($searchWord, true) . '', false), // 'LOWER(a.name) REGEXP ' . $this->db->Quote('' . $this->db->escape($searchWord, true) . '$', false), // 'LOWER(a.name) REGEXP ' . $this->db->Quote(' ' . $this->db->escape($searchWord, true) . '', false), // 'LOWER(a.name) REGEXP ' . $this->db->Quote('' . $this->db->escape($searchWord, true) . ' ', false), 'LOWER(a.name) REGEXP ' . $this->db->Quote('[[:<:]]' . $this->db->escape($searchWord, true) . '[[:>:]]', false) )); } $where[] = '((' . implode(') AND (', $searchWhere) . '))'; }Перейти к сообщению
