Is this correct code?

I have this line:

$sql = “SELECT Image, Chain, Country, City, Top as ‘’, Medium as ‘’, Low as
‘’ FROM Chains WHERE Country LIKE ? OR City LIKE ?”; // Your query

and I think I should add/convert it to take account of this

select utf8mb4’xxxx’ COLLATE utf8mb4general_ci = _utf8mb4’xxxx’

How do I put them together if that is what I should do, please?

A similar question was raised in a previous thread and I created the following:

Online Demo

Please note your Chain table was not available so I populated the table from “” with about 770 cities.

The search displays the following USA, Brazil, France and India countries and has been adapted so sub-strings are permitted such as “PAR” returns 8 matches.

I think a better search solution would be replace all foreign characters with an ASCII equivalent or even better still to search using the PHP metaphone(…) function.

If you would like your data tested then please supply the Chain table contents.

Using PhpMyAdmin to extract Chain table*
1. Select Pinto database
2. Select Chain table
3. Select Export
4. Select Go

Email the SQL CSV file and I will validate your data.


I appreciate the effort you´ve spent trying to help me with the thread about accents.

However, you got me totally confused and, in the end, decided to simply give it up. Your testing is about countries and their spelling. What for? I never mentioned spelling and I am not interested in the subject. Whether Brazil or Brasil they have no accents!

I am now trying something different and want to do it on my own in order to learn.

Please, forget about the other thread. It’s dead as a dodo.

And I am closing this one too to avoid further confusion.

Thank you very much for all you tried to do for me.

Hi @qim,

Some time ago I never resolved similar problems using iconv(…). After exhaustive testing I found the iconv(…) function very limited and only applicable in a couple of cases.

Your current City problem is very similar which accounts for my recent endeavours.

As far as spelling is concerned I was hoping to resolve searches such as “JULIEN” and “JULIAN”.

That has never been an issue. The issue was words that had accents. “JULIEN” and “JULIAN”. don’t have accents and are therefore irrelevant.

Like I said a solution is no longer needed as I’ve gone onto other things.

Thank you, all the same.