Filter Phrase Query

Posted by alsuelo on Stack Overflow See other posts from Stack Overflow or by alsuelo
Published on 2014-06-03T21:21:13Z Indexed on 2014/06/03 21:24 UTC
Read the original article Hit count: 149

Filed under:
|
|

I try to filter a phrase to make a search in my website i've this query, this code working with one word but when i type wit more than one isn't working becuase the print is without spaces.

$phrase = $this->getState($this->context.".filter_phrase");
      printf("Original string: %s\n", $phrase);
         if(!empty($phrase)) { 
            $escaped = $db->escape($phrase, true);
            printf("Escaped string: %s\n", $escaped);
            $quoted  = $db->quote("%" . $escaped . "%" , false);
            $query->where ('a.title LIKE '  .$quoted);
        }

Example i type king and the output is king , when i type the king the output is theking, i want to know if exist any way to conserve the blank spaces.

© Stack Overflow or respective owner

Related posts about php

Related posts about sql