0

Here's my current query:

SELECT * FROM example WHERE name LIKE '$myName%'

I have a lot of different rows in my database, and I want this query to get all rows with name starting with "myName". It works fine with this code, but it doesn't return rows with Polish chars.

I know about "COLLATE utf8_polish_ci" but I want to scrap also similar words, like in this example:

$myName = 'sc';

I want to scrape names like:

  • scary
  • script
  • scroll

etc.

but ALSO names with polish similar chars, like

  • ściana
  • ścięgno
  • śćmić

(where "s" could be "ś" and "c" could be "ć").

It was a bit hard to explain for me, I hope you understood this and can help me with better solution than making "OR" for each specific query.

mk27
  • 1
  • 1
  • 1
  • 2
  • Specify COLLATE explicitly. – Akina Apr 03 '20 at 09:48
  • I recommend normalizing the name field in your code, i.e: field `normalized_name` contains 'sciegno' instead of 'ścięgno'. This will save you a lot of trouble, as MySQL is bad with non-exact matches. – Tum Apr 03 '20 at 09:53

0 Answers0