daily pastebin goal
10%
SHARE
TWEET

Untitled

a guest Mar 26th, 2019 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $search_word = $modx->db->escape($_GET[‘search’]);
  2. //Подключение к сфинксу
  3. $modx->db->connect('localhost:9306', null, null, null);  
  4. //Запрос в сфинск
  5. $result = $modx->db->query("SELECT * FROM products WHERE MATCH('".$search_word."'); ");  
  6.         while( $row = $modx->db->getRow( $result ) ) {  
  7.                 $ids[] = $row['id']; //Получили все id ресурсов
  8.         }  
  9. // Отключение  
  10. $modx->db->disconnect() ;
  11.  
  12. // Повторное подключение  
  13. $modx->db->connect();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top