Why the wrong encoding on the website?

on the website meta charset utf-8.
the template file is saved in utf-8 Cyrillic, it is displayed correctly.

in phpmyadmin
Comparison of connection with MySQL: utf8_unicode-ci.
at the very table in which the recorded article: a comparison cp1251_general_ci

when connecting to the website database to the following settings:
mysql_query('SET NAMES utf-8');
mysql_query('SET CHARACTER SET utf-8' );
mysql_query('SET COLLATION_CONNECTION="cp1251_general_ci"' );

With these settings the text from the database on the website is displayed in kryakozyablik. Please help me to fix it. Changed the comparison table to utf8_general_ci does not help..
July 9th 19 at 13:18

Find more questions by tags MySQLPHP