I am migrating my site into php mysqli from php mysql_* methods.
I had following code that did the job:
mysql_query(\"SET NAMES \'utf8\' COLLA
You can use mysqli_set_charset
This is the preferred way to change the charset. Using mysqli_query() to set it (such as SET NAMES utf8) is not recommended.
However, to set collation, you will still have to use the SET NAMES query.
SET NAMES