Guest User

Untitled

a guest
Dec 26th, 2014
239
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $dsn = "mysql:host=127.0.0.1;port=9306;charset=utf8;";
  2. $options = [PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8'];
  3. $pdo = new \PDO($dsn, '', '', $options);
  4. $query = $pdo->prepare("
  5.    SELECT *
  6.    FROM news_index WHERE MATCH (:search)
  7.    LIMIT 1, 3
  8.    OPTION ranker=matchany
  9. ");
  10. $query->bindValue(':search', 'Локомотив', PDO::PARAM_STR);
  11. $query->execute();
  12.  
  13. var_dump($query->fetchAll(PDO::FETCH_ASSOC));
RAW Paste Data